public static final class PropMapHelper.Entry extends Object implements Map.Entry<CharSequence,String>, Comparable<Object>, Serializable, Cloneable
Map.Entry<CharSequence, String>
.PropMap
(using this class) the key
is a non empty String
that neither begins or ends with white space.key
of an Entry
object is always final.value
any String including null and empty is
allowed. The value
may be changed any time,
if immutable
is false. immutable
itself is set finally
an construction.value
null is (slightly)
contradictory to Map
's rules inherited by the using classes
PropMap
, AppLangMap
and Prop
but is very useful
enhancement especially for Prop
allowing to distinguish an empty
and no or not yet set value. (The rationale behind non null value for Map
is not quite clear — but the disadvantages in some applications
are.)String.intern()
).PropMapHelper
Map
,
Map.Entry
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected int |
entHash
The hash code of this entry.
|
protected boolean |
immutable
The value of this entry is immutable.
|
protected String |
key
The key of this entry.
|
protected int |
keyHash
The hash value of this entry.
|
protected String |
value
The value of this entry.
|
Modifier and Type | Method and Description |
---|---|
StringBuilder |
appendTo(StringBuilder stB)
State as String.
|
Object |
clone()
A copy of this entry.
|
int |
compareTo(Object o)
Compare this entry to another.
|
boolean |
equals(Object o)
Compare to other entry.
|
String |
getKey()
The key of this Entry.
|
String |
getValue()
The value of this Entry.
|
int |
hashCode()
Hash code.
|
static PropMapHelper.Entry |
make(CharSequence key,
CharSequence value,
boolean immutable)
Making an entry.
|
String |
setValue(String value)
Set / change the value.
|
String |
toString()
State as String.
|
finalize, getClass, notify, notifyAll, wait, wait, wait
comparingByKey, comparingByKey, comparingByValue, comparingByValue
protected String value
protected int entHash
protected final String key
protected final int keyHash
PropMapHelper.posHash(String)
.protected final boolean immutable
public final String getKey()
getKey
in interface Map.Entry<CharSequence,String>
Map.Entry.getKey()
public final String getValue()
getValue
in interface Map.Entry<CharSequence,String>
getKey()
public static PropMapHelper.Entry make(CharSequence key, CharSequence value, boolean immutable)
key
will be stripped from surrounding white space and must
(still) not be empty.key
is OK an PropMapHelper.Entry
object is made containing the
value
. If immutable
is true the made PropMapHelper.Entry
is (finally) immutable.IllegalArgumentException
- if the (trimmed) key is emptypublic int hashCode()
Map.Entry
's contract not to be confused with
the key
's positive hash value
(keyHash
).hashCode
in interface Map.Entry<CharSequence,String>
hashCode
in class Object
equals(Object)
public final boolean equals(Object o)
o
is of type
Map.Entry
and key and value are equal to
those of this object.public Object clone()
immutable
is true, this is returned as copies of (totally
and deeply) immutable objects are sheer waste.public StringBuilder appendTo(StringBuilder stB)
StringBuilder
stB stB
is null, it is generated with a starting capacity of 70.stB
- the StringBuilder to append to; will be made if nullpublic String setValue(String value) throws UnsupportedOperationException
value
.immutable
this method called
with a value
not the same (object) as original value throws a
UnsupportedOperationException
.setValue
in interface Map.Entry<CharSequence,String>
UnsupportedOperationException
- if immutable and value not the same
as the original oneMap.Entry.setValue(java.lang.Object)
public int compareTo(Object o)
compareTo
in interface Comparable<Object>
ClassCastException
- if the other object is no
Map.Entry
with a String keyComparable.compareTo(java.lang.Object)