com.github.andrewoma.dexx.collection.internal.hashmap
Class ListMap<K,V>

java.lang.Object
  extended by com.github.andrewoma.dexx.collection.internal.base.AbstractTraversable<E>
      extended by com.github.andrewoma.dexx.collection.internal.base.AbstractIterable<Pair<K,V>>
          extended by com.github.andrewoma.dexx.collection.internal.base.AbstractMap<K,V>
              extended by com.github.andrewoma.dexx.collection.internal.hashmap.ListMap<K,V>
All Implemented Interfaces:
Map<K,V>, Traversable<Pair<K,V>>, Iterable<Pair<K,V>>

public class ListMap<K,V>
extends AbstractMap<K,V>


Constructor Summary
ListMap()
           
 
Method Summary
 boolean containsKey(K key)
          Returns true if this map contains the specified key.
protected  com.github.andrewoma.dexx.collection.internal.hashmap.ListMap.Node<K,V> createNode(K key, V value)
           
static
<K,V> ListMap<K,V>
empty()
           
static
<K,V> BuilderFactory<Pair<K,V>,ListMap<K,V>>
factory()
           
<U> void
forEach(Function<Pair<K,V>,U> f)
          All collection methods can be built upon this forEach definition.
 V get(K key)
          Returns the value associated with the key or null if the no value exists with the key specified.
protected  K getKey()
           
protected  V getValue()
           
 boolean isEmpty()
          Returns true if this collection is empty.
 Iterator<Pair<K,V>> iterator()
           
 ListMap<K,V> put(K key, V value)
          Returns a map with the value specified associated to the key specified.
 ListMap<K,V> remove(K key)
          Returns a map with the value associated with the key removed if it exists.
 int size()
          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
 

Constructor Detail

ListMap

public ListMap()
Method Detail

factory

@NotNull
public static <K,V> BuilderFactory<Pair<K,V>,ListMap<K,V>> factory()

empty

@NotNull
public static <K,V> ListMap<K,V> empty()

size

public int size()
Description copied from interface: Traversable
Returns the size of the collection.

Warning: infinite collections are possible, as are collections that require traversal to calculate the size.

Specified by:
size in interface Traversable<Pair<K,V>>
Overrides:
size in class AbstractTraversable<Pair<K,V>>

get

public V get(@NotNull
             K key)
Description copied from interface: Map
Returns the value associated with the key or null if the no value exists with the key specified.


put

@NotNull
public ListMap<K,V> put(@NotNull
                                K key,
                                V value)
Description copied from interface: Map
Returns 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 ListMap<K,V> remove(@NotNull
                                   K key)
Description copied from interface: Map
Returns a map with the value associated with the key removed if it exists.


forEach

public <U> void forEach(@NotNull
                        Function<Pair<K,V>,U> f)
Description copied from interface: Traversable
All collection methods can be built upon this forEach definition.

Specified by:
forEach in interface Traversable<Pair<K,V>>
Overrides:
forEach in class AbstractIterable<Pair<K,V>>

iterator

@NotNull
public Iterator<Pair<K,V>> iterator()

getKey

protected K getKey()

getValue

protected V getValue()

tail

public ListMap<K,V> tail()

isEmpty

public boolean isEmpty()
Description copied from interface: Traversable
Returns true if this collection is empty.

Specified by:
isEmpty in interface Traversable<Pair<K,V>>
Overrides:
isEmpty in class AbstractTraversable<Pair<K,V>>

createNode

protected com.github.andrewoma.dexx.collection.internal.hashmap.ListMap.Node<K,V> createNode(K key,
                                                                                             V value)

containsKey

public boolean containsKey(@NotNull
                           K key)
Description copied from interface: Map
Returns true if this map contains the specified key.



Copyright © 2014. All Rights Reserved.