K
- The key type.V
- The value type.@NotThreadSafe public abstract static class ListMap.Abstract<K,V> extends AbstractMap<K,List<V>> implements ListMap<K,V>, Cloneable, Serializable
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
ListMap.Abstract<K,V>
Modifier | Constructor and Description |
---|---|
protected |
Abstract(Map<K,List<V>> map)
Constructs an instance.
|
Modifier and Type | Method and Description |
---|---|
void |
add(K key,
V value)
Adds a value to a key.
|
void |
clear() |
ListMap<K,V> |
clone() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,List<V>>> |
entrySet() |
List<V> |
get(Object key) |
List<V> |
getAll(Object key)
Gets all values for a key.
|
Optional<V> |
getFirst(K key)
Gets the first value for a key.
|
Optional<V> |
getLast(K key)
Gets the last value for a key.
|
boolean |
isEmpty() |
Set<K> |
keySet() |
protected void |
mapReplaced(Map<K,List<V>> map)
Called when the Map is replaced.
|
void |
put(K key)
Puts an entry with an empty values list.
|
List<V> |
put(K key,
List<V> value) |
List<V> |
remove(Object key) |
Optional<V> |
removeFirst(K key)
Removes the first value for a key.
|
Optional<V> |
removeLast(K key)
Removes the last value for a key.
|
int |
size() |
Collection<List<V>> |
values() |
public void clear()
public boolean containsKey(Object key)
public boolean containsValue(Object value)
public List<V> get(Object key)
public List<V> getAll(Object key)
public boolean isEmpty()
public Set<K> keySet()
public void put(K key)
public List<V> remove(Object key)
public Optional<V> removeFirst(K key)
When the values list becomes empty, the entry is removed.
removeFirst
in interface ListMap<K,V>
key
- The key.public Optional<V> removeLast(K key)
When the values list becomes empty, the entry is removed.
removeLast
in interface ListMap<K,V>
key
- The key.public int size()
public Collection<List<V>> values()
Copyright © 2003-2019 Serge Brisson. All Rights Reserved.