public abstract class ImmutableMap
extends java.lang.Object
implements java.lang.Cloneable
This map is thread safe because it is immutable. All methods that modify the map create and return a new map, rather than modifying the receiver.
| Modifier and Type | Field and Description |
|---|---|
static ImmutableMap |
EMPTY
The empty hash map.
|
protected static java.lang.String[] |
EMPTY_STRING_ARRAY |
| Constructor and Description |
|---|
ImmutableMap() |
| Modifier and Type | Method and Description |
|---|---|
protected static ImmutableMap |
createMap(int i) |
abstract java.lang.String |
get(java.lang.String key)
Returns the value associated with this key in the map, or
null if the key is not present in the map. |
protected abstract void |
internalPut(java.lang.String key,
java.lang.String value)
Destructively adds a key/value pair to this map.
|
abstract java.lang.String[] |
keys()
Returns an array of all keys in this map.
|
abstract ImmutableMap |
put(java.lang.String key,
java.lang.String value)
Returns a new map that is equal to this one, except with the given
key/value pair added.
|
abstract ImmutableMap |
removeKey(java.lang.String key)
Returns a map that is equal to this one, except without the given
key.
|
void |
shareStrings(StringPool set) |
abstract int |
size()
Returns the number of keys in this map.
|
java.lang.String |
toString() |
public static final ImmutableMap EMPTY
protected static final java.lang.String[] EMPTY_STRING_ARRAY
public abstract java.lang.String get(java.lang.String key)
null if the key is not present in the map.key - nullprotected static ImmutableMap createMap(int i)
protected abstract void internalPut(java.lang.String key,
java.lang.String value)
key - value - public abstract java.lang.String[] keys()
public abstract ImmutableMap put(java.lang.String key, java.lang.String value)
key - value - public abstract ImmutableMap removeKey(java.lang.String key)
key - public void shareStrings(StringPool set)
public abstract int size()
public java.lang.String toString()
toString in class java.lang.Object