Class ListMap<K,V>
- java.lang.Object
-
- com.github.andrewoma.dexx.collection.internal.base.AbstractTraversable<E>
-
- com.github.andrewoma.dexx.collection.internal.base.AbstractIterable<Pair<K,V>>
-
- com.github.andrewoma.dexx.collection.internal.base.AbstractMap<K,V>
-
- com.github.andrewoma.dexx.collection.internal.hashmap.ListMap<K,V>
-
- All Implemented Interfaces:
Iterable<Pair<K,V>>,Map<K,V>,Traversable<Pair<K,V>>,java.lang.Iterable<Pair<K,V>>
- Direct Known Subclasses:
ListMap.Node
public class ListMap<K,V> extends AbstractMap<K,V>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classListMap.Node<K,V>
-
Constructor Summary
Constructors Constructor Description ListMap()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(K key)Returns true if this map contains the specified key.protected ListMap.Node<K,V>createNode(K key, V value)static <K,V>
@NotNull ListMap<K,V>empty()static <K,V>
@NotNull BuilderFactory<Pair<K,V>,ListMap<K,V>>factory()<U> voidforEach(@NotNull Function<Pair<K,V>,U> f)All collection methods can be built upon thisforEachdefinition.Vget(K key)Returns the value associated with the key ornullif the no value exists with the key specified.protected KgetKey()protected VgetValue()booleanisEmpty()Returns true if this collection is empty.@NotNull java.util.Iterator<Pair<K,V>>iterator()@NotNull ListMap<K,V>put(K key, V value)Returns a map with the value specified associated to the key specified.@NotNull ListMap<K,V>remove(K key)Returns a map with the value associated with the key removed if it exists.intsize()Returns the size of the collection.ListMap<K,V>tail()-
Methods inherited from class com.github.andrewoma.dexx.collection.internal.base.AbstractMap
asMap, equals, hashCode, keys, values
-
Methods inherited from class com.github.andrewoma.dexx.collection.internal.base.AbstractTraversable
makeString, makeString, to, toArray, toArray, toIndexedList, toSet, toSortedSet, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.andrewoma.dexx.collection.Traversable
makeString, makeString, to, toArray, toArray, toIndexedList, toSet, toSortedSet
-
-
-
-
Field Detail
-
EMPTY
private static final ListMap<java.lang.Object,java.lang.Object> EMPTY
-
-
Method Detail
-
factory
@NotNull public static <K,V> @NotNull BuilderFactory<Pair<K,V>,ListMap<K,V>> factory()
-
empty
@NotNull public static <K,V> @NotNull ListMap<K,V> empty()
-
size
public int size()
Description copied from interface:TraversableReturns the size of the collection.Warning: infinite collections are possible, as are collections that require traversal to calculate the size.
- Specified by:
sizein interfaceTraversable<K>- Overrides:
sizein classAbstractTraversable<Pair<K,V>>
-
get
public V get(@NotNull K key)
Description copied from interface:MapReturns the value associated with the key ornullif the no value exists with the key specified.
-
put
@NotNull public @NotNull ListMap<K,V> put(@NotNull K key, V value)
Description copied from interface:MapReturns a map with the value specified associated to the key specified.If value already exists for the key, it will be replaced.
-
remove
@NotNull public @NotNull ListMap<K,V> remove(@NotNull K key)
Description copied from interface:MapReturns a map with the value associated with the key removed if it exists.
-
forEach
public <U> void forEach(@NotNull @NotNull Function<Pair<K,V>,U> f)Description copied from interface:TraversableAll collection methods can be built upon thisforEachdefinition.- Specified by:
forEachin interfaceTraversable<K>- Overrides:
forEachin classAbstractIterable<Pair<K,V>>
-
getKey
protected K getKey()
-
getValue
protected V getValue()
-
isEmpty
public boolean isEmpty()
Description copied from interface:TraversableReturns true if this collection is empty.- Specified by:
isEmptyin interfaceTraversable<K>- Overrides:
isEmptyin classAbstractTraversable<Pair<K,V>>
-
createNode
protected ListMap.Node<K,V> createNode(K key, V value)
-
-