it.unimi.dsi.fastutil.objects
Class AbstractObject2ShortMap<K>

java.lang.Object
  extended by it.unimi.dsi.fastutil.objects.AbstractObject2ShortFunction<K>
      extended by it.unimi.dsi.fastutil.objects.AbstractObject2ShortMap<K>
All Implemented Interfaces:
Function<K,java.lang.Short>, Object2ShortFunction<K>, Object2ShortMap<K>, java.io.Serializable, java.util.Map<K,java.lang.Short>
Direct Known Subclasses:
AbstractObject2ShortSortedMap, Object2ShortArrayMap, Object2ShortOpenCustomHashMap, Object2ShortOpenHashMap

public abstract class AbstractObject2ShortMap<K>
extends AbstractObject2ShortFunction<K>
implements Object2ShortMap<K>, java.io.Serializable

An abstract class providing basic methods for maps implementing a type-specific interface.

Optional operations just throw an UnsupportedOperationException. Generic versions of accessors delegate to the corresponding type-specific counterparts following the interface rules (they take care of returning null on a missing key).

As a further help, this class provides a BasicEntry inner class that implements a type-specific version of Map.Entry; it is particularly useful for those classes that do not implement their own entries (e.g., most immutable maps).

See Also:
Serialized Form

Nested Class Summary
static class AbstractObject2ShortMap.BasicEntry<K>
          This class provides a basic but complete type-specific entry class for all those maps implementations that do not have entries on their own (e.g., most immutable maps).
 
Nested classes/interfaces inherited from interface it.unimi.dsi.fastutil.objects.Object2ShortMap
Object2ShortMap.Entry<K>, Object2ShortMap.FastEntrySet<K>
 
Field Summary
static long serialVersionUID
           
 
Method Summary
 boolean containsKey(java.lang.Object k)
          Checks whether the given value is contained in keySet().
 boolean containsValue(java.lang.Object ov)
           
 boolean containsValue(short v)
          Checks whether the given value is contained in values().
 ObjectSet<java.util.Map.Entry<K,java.lang.Short>> entrySet()
          Returns a set view of the mappings contained in this map.
 boolean equals(java.lang.Object o)
           
 int hashCode()
          Returns a hash code for this map.
 boolean isEmpty()
           
 ObjectSet<K> keySet()
          Returns a type-specific-set view of the keys of this map.
 void putAll(java.util.Map<? extends K,? extends java.lang.Short> m)
          Puts all pairs in the given map.
 java.lang.String toString()
           
 ShortCollection values()
          Returns a type-specific-set view of the values of this map.
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractObject2ShortFunction
clear, defaultReturnValue, defaultReturnValue, get, put, put, remove, removeShort
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.unimi.dsi.fastutil.objects.Object2ShortMap
object2ShortEntrySet
 
Methods inherited from interface it.unimi.dsi.fastutil.objects.Object2ShortFunction
defaultReturnValue, defaultReturnValue, getShort, put, removeShort
 
Methods inherited from interface it.unimi.dsi.fastutil.Function
clear, get, put, remove, size
 
Methods inherited from interface java.util.Map
clear, get, put, remove, size
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Method Detail

containsValue

public boolean containsValue(java.lang.Object ov)
Specified by:
containsValue in interface java.util.Map<K,java.lang.Short>

containsValue

public boolean containsValue(short v)
Checks whether the given value is contained in values().

Specified by:
containsValue in interface Object2ShortMap<K>
See Also:
Map.containsValue(Object)

containsKey

public boolean containsKey(java.lang.Object k)
Checks whether the given value is contained in keySet().

Specified by:
containsKey in interface Function<K,java.lang.Short>
Specified by:
containsKey in interface java.util.Map<K,java.lang.Short>
Parameters:
k - the key.
Returns:
true if this function associates a value to key.
See Also:
Map.containsKey(Object)

putAll

public void putAll(java.util.Map<? extends K,? extends java.lang.Short> m)
Puts all pairs in the given map. If the map implements the interface of this map, it uses the faster iterators.

Specified by:
putAll in interface java.util.Map<K,java.lang.Short>
Parameters:
m - a map.

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Map<K,java.lang.Short>

keySet

public ObjectSet<K> keySet()
Returns a type-specific-set view of the keys of this map.

The view is backed by the set returned by entrySet(). Note that no attempt is made at caching the result of this method, as this would require adding some attributes that lightweight implementations would not need. Subclasses may easily override this policy by calling this method and caching the result, but implementors are encouraged to write more efficient ad-hoc implementations.

Specified by:
keySet in interface Object2ShortMap<K>
Specified by:
keySet in interface java.util.Map<K,java.lang.Short>
Returns:
a set view of the keys of this map; it may be safely cast to a type-specific interface.
See Also:
Map.keySet()

values

public ShortCollection values()
Returns a type-specific-set view of the values of this map.

The view is backed by the set returned by entrySet(). Note that no attempt is made at caching the result of this method, as this would require adding some attributes that lightweight implementations would not need. Subclasses may easily override this policy by calling this method and caching the result, but implementors are encouraged to write more efficient ad-hoc implementations.

Specified by:
values in interface Object2ShortMap<K>
Specified by:
values in interface java.util.Map<K,java.lang.Short>
Returns:
a set view of the values of this map; it may be safely cast to a type-specific interface.
See Also:
Map.values()

entrySet

public ObjectSet<java.util.Map.Entry<K,java.lang.Short>> entrySet()
Description copied from interface: Object2ShortMap
Returns a set view of the mappings contained in this map.

Note that this specification strengthens the one given in Map.entrySet().

Specified by:
entrySet in interface Object2ShortMap<K>
Specified by:
entrySet in interface java.util.Map<K,java.lang.Short>
Returns:
a set view of the mappings contained in this map.
See Also:
Map.entrySet()

hashCode

public int hashCode()
Returns a hash code for this map. The hash code of a map is computed by summing the hash codes of its entries.

Specified by:
hashCode in interface java.util.Map<K,java.lang.Short>
Overrides:
hashCode in class java.lang.Object
Returns:
a hash code for this map.

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Map<K,java.lang.Short>
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object