|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openstreetmap.josm.tools.MultiMap<A,B>
public class MultiMap<A,B>
MultiMap - maps keys to multiple values Corresponds to Google guava LinkedHashMultimap and Apache Collections MultiValueMap but it is an independent (simple) implementation.
Field Summary | |
---|---|
private java.util.Map<A,java.util.LinkedHashSet<B>> |
map
|
Constructor Summary | |
---|---|
MultiMap()
|
|
MultiMap(int capacity)
|
Method Summary | |
---|---|
void |
clear()
|
boolean |
contains(A key,
B value)
Returns true if the multimap contains a value for a key. |
boolean |
containsKey(A key)
|
java.util.Set<java.util.Map.Entry<A,java.util.LinkedHashSet<B>>> |
entrySet()
|
java.util.Set<B> |
get(A key)
Returns the Set associated with the given key. |
java.util.LinkedHashSet<B> |
getValues(A key)
Like get, but returns an empty Set if nothing has been mapped to the key. |
boolean |
isEmpty()
|
java.util.Set<A> |
keySet()
Get the keySet. |
void |
put(A key,
B value)
Map a key to a value. |
void |
putAll(A key,
java.util.Collection<B> values)
Map the key to all the given values. |
void |
putVoid(A key)
Put a key that maps to nothing. |
java.util.LinkedHashSet<B> |
remove(A key)
Removes all mappings for a certain key. |
boolean |
remove(A key,
B value)
Removes a cerain key=value mapping. |
int |
size()
Returns the number of keys. |
java.lang.String |
toString()
|
java.util.Collection<java.util.LinkedHashSet<B>> |
values()
Returns a collection of all value sets. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final java.util.Map<A,java.util.LinkedHashSet<B>> map
Constructor Detail |
---|
public MultiMap()
public MultiMap(int capacity)
Method Detail |
---|
public void put(A key, B value)
public void putVoid(A key)
public void putAll(A key, java.util.Collection<B> values)
public java.util.Set<A> keySet()
public java.util.Set<B> get(A key)
public java.util.LinkedHashSet<B> getValues(A key)
public boolean isEmpty()
public boolean containsKey(A key)
public boolean contains(A key, B value)
key
- The keyvalue
- The value
public void clear()
public java.util.Set<java.util.Map.Entry<A,java.util.LinkedHashSet<B>>> entrySet()
public int size()
public java.util.Collection<java.util.LinkedHashSet<B>> values()
public boolean remove(A key, B value)
public java.util.LinkedHashSet<B> remove(A key)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |