org.javimmutable.collections.common
Class AbstractJImmutableMap<K,V>

java.lang.Object
  extended by org.javimmutable.collections.common.AbstractJImmutableMap<K,V>
All Implemented Interfaces:
Iterable<JImmutableMap.Entry<K,V>>, Cursorable<JImmutableMap.Entry<K,V>>, Insertable<JImmutableMap.Entry<K,V>>, JImmutableMap<K,V>, Mapped<K,V>
Direct Known Subclasses:
EmptyHashMap, JImmutableHashMap, JImmutableInsertOrderMap, JImmutableTreeMap

@Immutable
public abstract class AbstractJImmutableMap<K,V>
extends Object
implements JImmutableMap<K,V>


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.javimmutable.collections.JImmutableMap
JImmutableMap.Entry<K,V>
 
Constructor Summary
AbstractJImmutableMap()
           
 
Method Summary
 boolean equals(Object o)
           
 V get(K key)
          Return the value associated with key or null if no value is associated.
 Map<K,V> getMap()
          Creates an unmodifiable java.util.Map reflecting the values of this PersistentMap.
 int hashCode()
           
 Insertable<JImmutableMap.Entry<K,V>> insert(JImmutableMap.Entry<K,V> e)
          Adds the key/value pair to this map.
 boolean isEmpty()
           
 Iterator<JImmutableMap.Entry<K,V>> iterator()
           
 Cursor<K> keysCursor()
          Creates a Cursor to access all of the Map's keys.
 String toString()
           
 Cursor<V> valuesCursor()
          Creates a Cursor to access all of the Map's values.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.javimmutable.collections.JImmutableMap
assign, delete, deleteAll, find, findEntry, size
 
Methods inherited from interface org.javimmutable.collections.Mapped
getValueOr
 
Methods inherited from interface org.javimmutable.collections.Cursorable
cursor
 

Constructor Detail

AbstractJImmutableMap

public AbstractJImmutableMap()
Method Detail

get

@Nullable
public V get(K key)
Description copied from interface: Mapped
Return the value associated with key or null if no value is associated. Note that if null is an acceptable value to the container then this method will be ambiguous and find() should be used instead.

Specified by:
get in interface Mapped<K,V>
Parameters:
key - identifies the value to retrieve
Returns:
value associated with key or null if no value is associated

insert

@Nonnull
public Insertable<JImmutableMap.Entry<K,V>> insert(@Nonnull
                                                           JImmutableMap.Entry<K,V> e)
Adds the key/value pair to this map. Any value already existing for the specified key is replaced with the new value.

Specified by:
insert in interface Insertable<JImmutableMap.Entry<K,V>>
Specified by:
insert in interface JImmutableMap<K,V>
Parameters:
e -
Returns:

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface JImmutableMap<K,V>
Returns:
true only if list contains no values

keysCursor

@Nonnull
public Cursor<K> keysCursor()
Description copied from interface: JImmutableMap
Creates a Cursor to access all of the Map's keys.

Specified by:
keysCursor in interface JImmutableMap<K,V>
Returns:

valuesCursor

@Nonnull
public Cursor<V> valuesCursor()
Description copied from interface: JImmutableMap
Creates a Cursor to access all of the Map's values.

Specified by:
valuesCursor in interface JImmutableMap<K,V>
Returns:

getMap

@Nonnull
public Map<K,V> getMap()
Description copied from interface: JImmutableMap
Creates an unmodifiable java.util.Map reflecting the values of this PersistentMap.

Specified by:
getMap in interface JImmutableMap<K,V>
Returns:
Map view of this PersistentMap

iterator

public Iterator<JImmutableMap.Entry<K,V>> iterator()
Specified by:
iterator in interface Iterable<JImmutableMap.Entry<K,V>>

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2014 Burton Computer Corporation. All rights reserved.