K
- The key type.V
- The value type.public interface ListMap<K,V>
extends Map<K,List<V>>
Extends a Map to allow multiple non null values for a single key.
Modifier and Type | Interface and Description |
---|---|
static class |
ListMap.Abstract<K,V>
Abstract list map.
|
Modifier and Type | Method and Description |
---|---|
void |
add(K key,
V value)
Adds a value to a 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.
|
void |
put(K key)
Puts an entry with an empty values list.
|
Optional<V> |
removeFirst(K key)
Removes the first value for a key.
|
Optional<V> |
removeLast(K key)
Removes the last value for a key.
|
void add(@Nonnull K key, @Nonnull V value)
key
- The key.value
- The value.@Nonnull @CheckReturnValue List<V> getAll(@Nonnull Object key)
key
- The key.@Nonnull @CheckReturnValue Optional<V> getFirst(@Nonnull K key)
key
- The key.@Nonnull @CheckReturnValue Optional<V> getLast(@Nonnull K key)
key
- The key.void put(@Nonnull K key)
key
- The key.@Nonnull Optional<V> removeFirst(@Nonnull K key)
When the values list becomes empty, the entry is removed.
key
- The key.Copyright © 2003-2019 Serge Brisson. All Rights Reserved.