|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.javimmutable.collections.listmap.AbstractJImmutableListMap<K,V>
@Immutable public abstract class AbstractJImmutableListMap<K,V>
Constructor Summary | |
---|---|
protected |
AbstractJImmutableListMap(JImmutableMap<K,JImmutableList<V>> contents)
|
Method Summary | |
---|---|
JImmutableListMap<K,V> |
assign(K key,
JImmutableList<V> value)
Sets the list associated with a specific key. |
protected JImmutableList<V> |
copyList(JImmutableList<V> original)
Overridable by derived classes to create a compatible copy of the specified list. |
protected abstract JImmutableListMap<K,V> |
create(JImmutableMap<K,JImmutableList<V>> map)
Implemented by derived classes to create a new instance of the appropriate class. |
Cursor<JImmutableMap.Entry<K,JImmutableList<V>>> |
cursor()
|
JImmutableListMap<K,V> |
delete(K key)
Deletes the entry for the specified key (if any). |
JImmutableListMap<K,V> |
deleteAll()
|
protected JImmutableList<V> |
emptyList()
Overridable by derived classes to create a new empty list |
boolean |
equals(Object o)
|
Holder<JImmutableList<V>> |
find(K key)
Return a Holder containing the value associated wth the key or an empty Holder if no value is associated with the key. |
JImmutableList<V> |
get(K key)
Return the value associated with key or null if no value is associated. |
JImmutableList<V> |
getList(K key)
Return the list associated with key or an empty list if no list is associated. |
JImmutableList<V> |
getValueOr(K key,
JImmutableList<V> defaultValue)
Return the value associated with key or defaultValue if no value is associated. |
int |
hashCode()
|
Insertable<JImmutableMap.Entry<K,V>> |
insert(JImmutableMap.Entry<K,V> e)
Add key/value entry to the map, replacing any existing entry with same key. |
JImmutableListMap<K,V> |
insert(K key,
V value)
Add value to the list for the specified key. |
protected JImmutableList<V> |
insertInList(JImmutableList<V> list,
V value)
Overridable by derived classes to insert a value into a list in some way. |
boolean |
isEmpty()
|
Iterator<JImmutableMap.Entry<K,JImmutableList<V>>> |
iterator()
|
Cursor<K> |
keysCursor()
Creates a Cursor to access all of the Map's keys. |
int |
size()
Return the number of keys in the map. |
String |
toString()
|
Cursor<V> |
valuesCursor(K key)
Creates a Cursor to access all of the specified key's list. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected AbstractJImmutableListMap(JImmutableMap<K,JImmutableList<V>> contents)
Method Detail |
---|
@Nonnull public JImmutableList<V> getList(@Nonnull K key)
JImmutableListMap
getList
in interface JImmutableListMap<K,V>
key
- identifies the value to retrieve
@Nonnull public JImmutableListMap<K,V> assign(@Nonnull K key, @Nonnull JImmutableList<V> value)
JImmutableListMap
assign
in interface JImmutableListMap<K,V>
key
- non-null keyvalue
- list of possibly null values to use for this key
@Nonnull public JImmutableListMap<K,V> insert(@Nonnull K key, @Nullable V value)
JImmutableListMap
insert
in interface JImmutableListMap<K,V>
@Nonnull public JImmutableListMap<K,V> delete(@Nonnull K key)
JImmutableListMap
delete
in interface JImmutableListMap<K,V>
key
- non-null key
public int size()
JImmutableListMap
size
in interface JImmutableListMap<K,V>
public boolean isEmpty()
isEmpty
in interface JImmutableListMap<K,V>
@Nonnull public Cursor<K> keysCursor()
JImmutableListMap
keysCursor
in interface JImmutableListMap<K,V>
@Nonnull public Cursor<V> valuesCursor(@Nonnull K key)
JImmutableListMap
valuesCursor
in interface JImmutableListMap<K,V>
@Nonnull public Cursor<JImmutableMap.Entry<K,JImmutableList<V>>> cursor()
cursor
in interface Cursorable<JImmutableMap.Entry<K,JImmutableList<V>>>
@Nonnull public Insertable<JImmutableMap.Entry<K,V>> insert(@Nonnull JImmutableMap.Entry<K,V> e)
JImmutableListMap
insert
in interface Insertable<JImmutableMap.Entry<K,V>>
insert
in interface JImmutableListMap<K,V>
public Iterator<JImmutableMap.Entry<K,JImmutableList<V>>> iterator()
iterator
in interface Iterable<JImmutableMap.Entry<K,JImmutableList<V>>>
@Nullable public JImmutableList<V> get(K key)
Mapped
get
in interface Mapped<K,JImmutableList<V>>
key
- identifies the value to retrieve
public JImmutableList<V> getValueOr(K key, JImmutableList<V> defaultValue)
Mapped
getValueOr
in interface Mapped<K,JImmutableList<V>>
key
- identifies the value to retrievedefaultValue
- value to return if no entry exists for key
@Nonnull public Holder<JImmutableList<V>> find(K key)
Mapped
find
in interface Mapped<K,JImmutableList<V>>
key
- identifies the value to retrieve
@Nonnull public JImmutableListMap<K,V> deleteAll()
deleteAll
in interface JImmutableListMap<K,V>
public int hashCode()
hashCode
in class Object
public boolean equals(Object o)
equals
in class Object
public String toString()
toString
in class Object
protected abstract JImmutableListMap<K,V> create(JImmutableMap<K,JImmutableList<V>> map)
map
-
protected JImmutableList<V> copyList(JImmutableList<V> original)
@Nonnull protected JImmutableList<V> emptyList()
protected JImmutableList<V> insertInList(JImmutableList<V> list, V value)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |