|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectch.javasoft.util.map.AbstractMultiValueMap<K,V>
ch.javasoft.util.map.AbstractMutableMultiValueMap<Integer,Integer>
ch.javasoft.util.map.DefaultIntIntMultiValueMap
public class DefaultIntIntMultiValueMap
The IntIntMultiValueMap is a mutable multi value map for int
keys and values.
| Constructor Summary | |
|---|---|
DefaultIntIntMultiValueMap()
Constructor for an empty multi value map |
|
DefaultIntIntMultiValueMap(DefaultIntIntMultiValueMap copy)
Constructor for a multi value map based on an existing one |
|
DefaultIntIntMultiValueMap(IntMap<IntCollection> collectionMap)
Constructor for a multi value map based on the given collection map. |
|
DefaultIntIntMultiValueMap(MultiValueMap<? extends Integer,? extends Integer> copy)
Constructor for a multi value map based on an existing one |
|
| Method Summary | |
|---|---|
boolean |
add(Integer key,
Integer value)
Adds the given value to the multi value map |
boolean |
add(int key,
int value)
Adds the given value to the key collection |
boolean |
addAll(Integer key,
Collection<? extends Integer> values)
Adds the given values to the key collection |
boolean |
addAll(int key,
int... values)
Adds the given values to the key collection |
boolean |
addAll(int key,
IntCollection values)
Adds the given values to the key collection |
boolean |
addAll(IntIntMultiValueMap mapping)
Adds the key/value-collection entries of the given mapping to this key collection |
boolean |
addAll(IntMap<? extends Integer> map)
Adds the key/value map entries of the given map to this key collection |
boolean |
addAllNested(IntMap<? extends IntCollection> map)
Adds the key/value-collection entries of the given map to this key collection |
IntMap<? extends IntCollection> |
asCollectionMap()
Implementation returns an IntHashMap containing
DefaultIntList instances. |
IntMap<Integer> |
asSingleValueMap()
Implementation returns an IntHashMap containing
the single values. |
boolean |
clear()
Removes all entries from this mapping |
DefaultIntIntMultiValueMap |
clone()
|
boolean |
contains(int key)
Returns true if the value collection is non-empty |
boolean |
contains(int key,
int value)
Returns true if the value collection contains at least one occurrence of the given value |
boolean |
contains(Object key)
Returns true if the value collection is non-empty |
boolean |
contains(Object key,
Integer value)
Returns true if the value collection contains at least one occurrence of the given value |
int |
count(int key)
Returns the number of values in the value collection |
int |
count(Object key)
Returns the number of values in the value collection |
protected IntCollection |
createCollection(int key)
Returns a new int list instance. |
static DefaultIntIntMultiValueMap |
createFromCollectionMap(Map<? extends Integer,? extends Collection<? extends Integer>> collectionMap)
Creates a multi value map from an existing collection map. |
static DefaultIntIntMultiValueMap |
createFromSingleValueMap(Map<? extends Integer,? extends Integer> singleMap)
Creates a multi value map from an existing (single value) map |
protected IntMap<IntCollection> |
createMap()
Returns a new map instance. |
IntCollection |
get(int key)
Returns an unmodifiable value collection. |
IntCollection |
get(Object key)
Returns an unmodifiable value collection. |
int |
getFirst(int key)
Returns the first value associated with this key, or throws an exception if no such value exists |
Integer |
getFirst(Object key)
Returns the first value of the value collection, or null if no such value exists |
protected IntCollection |
getOrCreateCollection(int key)
Returns the value collection for the specified key. |
IntIntMultiValueMap |
invert()
Implementation returns a new DefaultIntIntMultiValueMap instance. |
boolean |
isEmpty()
Returns true if this map is empty |
IntSet |
keySet()
Returns an modifiable key set, i.e. |
boolean |
remove(int key)
Returns all values belonging to this key, i.e. |
boolean |
remove(int key,
int value)
Returns a single value of the value collection, if it exists |
boolean |
remove(Object key)
Returns all values belonging to this key, i.e. |
boolean |
remove(Object key,
Integer value)
Returns a single value of the value collection, if it exists |
IntIterable |
values()
Returns an unmodifiable iterator for all values |
| Methods inherited from class ch.javasoft.util.map.AbstractMutableMultiValueMap |
|---|
addAll, addAll, addAll, addAllNested |
| Methods inherited from class ch.javasoft.util.map.AbstractMultiValueMap |
|---|
equals, hashCode, keySize, toString, valueSize |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface ch.javasoft.util.map.IntIntMultiValueMap |
|---|
keySize, valueSize |
| Methods inherited from interface ch.javasoft.util.map.MultiValueMap |
|---|
addAll, addAll, addAll, addAllNested |
| Constructor Detail |
|---|
public DefaultIntIntMultiValueMap()
public DefaultIntIntMultiValueMap(MultiValueMap<? extends Integer,? extends Integer> copy)
public DefaultIntIntMultiValueMap(DefaultIntIntMultiValueMap copy)
public DefaultIntIntMultiValueMap(IntMap<IntCollection> collectionMap)
createFromCollectionMap(Map) can be used.
collectionMap - the map to use for this multi value map| Method Detail |
|---|
public static DefaultIntIntMultiValueMap createFromSingleValueMap(Map<? extends Integer,? extends Integer> singleMap)
singleMap - the map containing key/value pairs to add to the new map
public static DefaultIntIntMultiValueMap createFromCollectionMap(Map<? extends Integer,? extends Collection<? extends Integer>> collectionMap)
collectionMap - the map containing key/list-of-value entries to add
to the new map
public boolean add(Integer key,
Integer value)
add in interface MultiValueMap<Integer,Integer>add in class AbstractMultiValueMap<Integer,Integer>key - the key which identifies the value collectionvalue - the value to add
UnsupportedOperationException - if this is an immutable map
public boolean add(int key,
int value)
IntIntMultiValueMap
add in interface IntIntMultiValueMapkey - the key which identifies the value collectionvalue - the value to add
public boolean addAll(int key,
IntCollection values)
IntIntMultiValueMap
addAll in interface IntIntMultiValueMapkey - the key which identifies the value collectionvalues - the values to add
public boolean addAll(Integer key,
Collection<? extends Integer> values)
AbstractMutableMultiValueMap
addAll in interface MultiValueMap<Integer,Integer>addAll in class AbstractMutableMultiValueMap<Integer,Integer>key - the key which identifies the value collectionvalues - the values to add
public boolean addAll(int key,
int... values)
IntIntMultiValueMap
addAll in interface IntIntMultiValueMapkey - the key which identifies the value collectionvalues - the values to add
public boolean addAll(IntMap<? extends Integer> map)
IntIntMultiValueMap
addAll in interface IntIntMultiValueMapmap - the map containing key/value-collection entries to add
public boolean addAll(IntIntMultiValueMap mapping)
IntIntMultiValueMap
addAll in interface IntIntMultiValueMapmapping - the mapping containing key/value-collection entries to add
public boolean addAllNested(IntMap<? extends IntCollection> map)
IntIntMultiValueMap
addAllNested in interface IntIntMultiValueMapmap - the map containing key/value-collection entries to add
public IntCollection get(Object key)
get in interface MultiValueMap<Integer,Integer>key - the key which identifies the value collection
MultiValueMap.get(Object)public IntCollection get(int key)
get in interface IntIntMultiValueMapkey - the key which identifies the value collection
MultiValueMap.get(Object)public Integer getFirst(Object key)
MultiValueMap
getFirst in interface MultiValueMap<Integer,Integer>getFirst in class AbstractMultiValueMap<Integer,Integer>key - the key which identifies the value collection
public int getFirst(int key)
getFirst in interface IntIntMultiValueMapkey - the key to search for
NoSuchElementException - if no value exists for the given keypublic int count(Object key)
MultiValueMap
count in interface MultiValueMap<Integer,Integer>key - the key which identifies the value collection
public int count(int key)
IntIntMultiValueMap
count in interface IntIntMultiValueMapkey - the key which identifies the value collection
public boolean isEmpty()
MultiValueMap
isEmpty in interface IntIntMultiValueMapisEmpty in interface MultiValueMap<Integer,Integer>isEmpty in class AbstractMultiValueMap<Integer,Integer>public boolean contains(Object key)
MultiValueMap
contains in interface MultiValueMap<Integer,Integer>contains in class AbstractMultiValueMap<Integer,Integer>key - the key which identifies the value collection
public boolean contains(int key)
IntIntMultiValueMap
contains in interface IntIntMultiValueMapkey - the key which identifies the value collection
public boolean contains(Object key,
Integer value)
MultiValueMap
contains in interface MultiValueMap<Integer,Integer>key - the key which identifies the value collectionvalue - the value to look for
public boolean contains(int key,
int value)
IntIntMultiValueMap
contains in interface IntIntMultiValueMapkey - the key which identifies the value collectionvalue - the value to look for
public boolean remove(Object key)
remove in interface MultiValueMap<Integer,Integer>remove in class AbstractMultiValueMap<Integer,Integer>key - the key which identifies the value collection
UnsupportedOperationException - if this is an immutable mappublic boolean remove(int key)
IntIntMultiValueMap
remove in interface IntIntMultiValueMapkey - the key which identifies the value collection
public boolean remove(Object key,
Integer value)
remove in interface MultiValueMap<Integer,Integer>remove in class AbstractMultiValueMap<Integer,Integer>key - the key which identifies the value collectionvalue - the value to remove
UnsupportedOperationException - if this is an immutable map
public boolean remove(int key,
int value)
IntIntMultiValueMap
remove in interface IntIntMultiValueMapkey - the key which identifies the value collectionvalue - the value to remove
public boolean clear()
clear in interface IntIntMultiValueMapclear in interface MultiValueMap<Integer,Integer>clear in class AbstractMultiValueMap<Integer,Integer>UnsupportedOperationException - if this is an immutable mappublic IntSet keySet()
keySet in interface IntIntMultiValueMapkeySet in interface MultiValueMap<Integer,Integer>MultiValueMap.get(Object)public IntIterable values()
values in interface IntIntMultiValueMapvalues in interface MultiValueMap<Integer,Integer>values in class AbstractMultiValueMap<Integer,Integer>MultiValueMap.values()public IntMap<? extends IntCollection> asCollectionMap()
IntHashMap containing
DefaultIntList instances.
Changing the returned map does not affect this multi value map.
asCollectionMap in interface IntIntMultiValueMapasCollectionMap in interface MultiValueMap<Integer,Integer>asCollectionMap in class AbstractMultiValueMap<Integer,Integer>MultiValueMap.asCollectionMap()public IntMap<Integer> asSingleValueMap()
IntHashMap containing
the single values.
Changing the returned map does not affect this multi value map.
asSingleValueMap in interface IntIntMultiValueMapasSingleValueMap in interface MultiValueMap<Integer,Integer>asSingleValueMap in class AbstractMultiValueMap<Integer,Integer>MultiValueMap.asSingleValueMap()public IntIntMultiValueMap invert()
DefaultIntIntMultiValueMap instance.
Changing the returned map does not affect this multi value map.
invert in interface IntIntMultiValueMapinvert in interface MultiValueMap<Integer,Integer>invert in class AbstractMultiValueMap<Integer,Integer>MultiValueMap.invert()public DefaultIntIntMultiValueMap clone()
clone in class Objectprotected IntCollection getOrCreateCollection(int key)
created and added to the backing
map.
key - the key identifying the value collection
protected IntCollection createCollection(int key)
ArrayList of
size one is created. The method shall never return null.
key - the key for which a value collection is to be created
protected IntMap<IntCollection> createMap()
IntHashMap is returned.
The method shall never return null.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||