public class DefaultImmutableMap<S,T> extends java.lang.Object implements ImmutableMap<S,T>
Modifier and Type | Class and Description |
---|---|
private static class |
DefaultImmutableMap.MapEntry<S,T>
inner class for the entries
|
private static class |
DefaultImmutableMap.MapEntryIterator<S,T>
iterator for the values
|
private static class |
DefaultImmutableMap.MapIterator<S,T>
iterator for the values
|
private static class |
DefaultImmutableMap.MapKeyIterator<S,T> |
private static class |
DefaultImmutableMap.MapValueIterator<S,T> |
private static class |
DefaultImmutableMap.NILMap<S,T>
the empty map
|
Modifier and Type | Field and Description |
---|---|
private ImmutableMapEntry<S,T> |
entry
list of pairs (key,value)
|
private DefaultImmutableMap<S,T> |
parent |
private static long |
serialVersionUID
generated serial
|
private int |
size |
Modifier | Constructor and Description |
---|---|
protected |
DefaultImmutableMap()
only for use by NILMap
|
protected |
DefaultImmutableMap(ImmutableMapEntry<S,T> entry)
creates new map with mapping entry
|
protected |
DefaultImmutableMap(ImmutableMapEntry<S,T> entry,
DefaultImmutableMap<S,T> parent)
creates new map with mapping entry and parent map
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsKey(S key) |
boolean |
containsValue(T value) |
private DefaultImmutableMap<S,T> |
createMap(ImmutableMapEntry<S,T>[] stack,
int counter,
DefaultImmutableMap<S,T> p_parent) |
boolean |
equals(java.lang.Object o) |
T |
get(S key) |
int |
hashCode() |
boolean |
isEmpty()
returns true if the map is empty
|
java.util.Iterator<ImmutableMapEntry<S,T>> |
iterator() |
java.util.Iterator<S> |
keyIterator() |
static <S,T> DefaultImmutableMap<S,T> |
nilMap()
the empty map
|
ImmutableMap<S,T> |
put(S key,
T value)
inserts mapping
null is not allowed for key or value. |
DefaultImmutableMap<S,T> |
remove(S key)
removes mapping (key,...) from map
|
ImmutableMap<S,T> |
removeAll(T value)
removes all mappings (...
|
int |
size() |
java.lang.String |
toString() |
java.util.Iterator<T> |
valueIterator() |
private static final long serialVersionUID
private final DefaultImmutableMap<S,T> parent
private final ImmutableMapEntry<S,T> entry
private final int size
protected DefaultImmutableMap()
protected DefaultImmutableMap(ImmutableMapEntry<S,T> entry)
protected DefaultImmutableMap(ImmutableMapEntry<S,T> entry, DefaultImmutableMap<S,T> parent)
public static <S,T> DefaultImmutableMap<S,T> nilMap()
public ImmutableMap<S,T> put(S key, T value)
null
is not allowed for key or value.put
in interface ImmutableMap<S,T>
key
- a S to be used as keyvalue
- a T to be stored as valuepublic T get(S key)
get
in interface ImmutableMap<S,T>
public int size()
size
in interface ImmutableMap<S,T>
public boolean isEmpty()
isEmpty
in interface ImmutableMap<S,T>
public boolean containsKey(S key)
containsKey
in interface ImmutableMap<S,T>
public boolean containsValue(T value)
containsValue
in interface ImmutableMap<S,T>
private DefaultImmutableMap<S,T> createMap(ImmutableMapEntry<S,T>[] stack, int counter, DefaultImmutableMap<S,T> p_parent)
public DefaultImmutableMap<S,T> remove(S key)
remove
in interface ImmutableMap<S,T>
public ImmutableMap<S,T> removeAll(T value)
removeAll
in interface ImmutableMap<S,T>
public java.util.Iterator<S> keyIterator()
keyIterator
in interface ImmutableMap<S,T>
public java.util.Iterator<T> valueIterator()
valueIterator
in interface ImmutableMap<S,T>
public java.util.Iterator<ImmutableMapEntry<S,T>> iterator()
iterator
in interface java.lang.Iterable<ImmutableMapEntry<S,T>>
iterator
in interface ImmutableMap<S,T>
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object