it.unimi.dsi.fastutil.shorts
Class Short2LongMaps.UnmodifiableMap

java.lang.Object
  extended byit.unimi.dsi.fastutil.shorts.AbstractShort2LongMap
      extended byit.unimi.dsi.fastutil.shorts.Short2LongMaps.UnmodifiableMap
All Implemented Interfaces:
Map, Serializable, Short2LongMap
Direct Known Subclasses:
Short2LongSortedMaps.UnmodifiableSortedMap
Enclosing class:
Short2LongMaps

public static class Short2LongMaps.UnmodifiableMap
extends AbstractShort2LongMap
implements Short2LongMap, Serializable

An unmodifiable wrapper class for maps.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class it.unimi.dsi.fastutil.shorts.AbstractShort2LongMap
AbstractShort2LongMap.BasicEntry
 
Nested classes inherited from class it.unimi.dsi.fastutil.shorts.Short2LongMap
Short2LongMap.Entry
 
Field Summary
static long serialVersionUID
           
 
Method Summary
 void clear()
           
 boolean containsKey(Object ok)
           
 boolean containsKey(short k)
          Checks whether the given value is contained in keySet().
 boolean containsValue(long v)
          Checks whether the given value is contained in values().
 boolean containsValue(Object ov)
           
 long defaultReturnValue()
          Gets the default return value.
 void defaultReturnValue(long defRetValue)
          Sets the default return value.
 Set entrySet()
           
 Object get(Object ok)
          Delegates to the corresponding type-specific method, taking care of returning null on a missing key.
 long get(short k)
          Returns the value to which the given key is mapped.
 Set keySet()
          Returns a type-specific-set view of the keys of this map.
 Object put(Object k, Object v)
          Delegates to the corresponding type-specific method, taking care of returning null on a missing key.
 long put(short k, long v)
          Adds a pair to the map.
 void putAll(Map m)
          Puts all pairs in the given map.
 void putAll(Short2LongMap c)
           
 Object remove(Object ok)
          Delegates to the corresponding type-specific method, taking care of returning null on a missing key.
 long remove(short k)
          Removes the mapping with the given key.
 int size()
           
 String toString()
           
 Collection values()
          Returns a type-specific-set view of the values of this map.
 
Methods inherited from class it.unimi.dsi.fastutil.shorts.AbstractShort2LongMap
equals, getDefRetValue, hashCode, isEmpty, setDefRetValue
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.unimi.dsi.fastutil.shorts.Short2LongMap
getDefRetValue, setDefRetValue
 
Methods inherited from interface java.util.Map
equals, hashCode, isEmpty
 

Field Detail

serialVersionUID

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

remove

public Object remove(Object ok)
Description copied from class: AbstractShort2LongMap
Delegates to the corresponding type-specific method, taking care of returning null on a missing key.

This method must check whether the provided key is in the map using containsKey(). Thus, it probes the map twice. Implementors of subclasses should override it with a more efficient method.

Specified by:
remove in interface Map
Overrides:
remove in class AbstractShort2LongMap

get

public Object get(Object ok)
Description copied from class: AbstractShort2LongMap
Delegates to the corresponding type-specific method, taking care of returning null on a missing key.

This method must check whether the provided key is in the map using containsKey(). Thus, it probes the map twice. Implementors of subclasses should override it with a more efficient method.

Specified by:
get in interface Map
Overrides:
get in class AbstractShort2LongMap

size

public int size()
Specified by:
size in interface Map

containsKey

public boolean containsKey(short k)
Description copied from class: AbstractShort2LongMap
Checks whether the given value is contained in AbstractShort2LongMap.keySet().

Specified by:
containsKey in interface Short2LongMap
Overrides:
containsKey in class AbstractShort2LongMap

containsValue

public boolean containsValue(long v)
Description copied from class: AbstractShort2LongMap
Checks whether the given value is contained in AbstractShort2LongMap.values().

Specified by:
containsValue in interface Short2LongMap
Overrides:
containsValue in class AbstractShort2LongMap

defaultReturnValue

public long defaultReturnValue()
Description copied from interface: Short2LongMap
Gets the default return value.

Specified by:
defaultReturnValue in interface Short2LongMap
Overrides:
defaultReturnValue in class AbstractShort2LongMap

defaultReturnValue

public void defaultReturnValue(long defRetValue)
Description copied from interface: Short2LongMap
Sets the default return value. This value must be returned by type-specific versions of get(), put() and remove() to denote that the map does not contain the specified key. It must be 0/false/null by default.

Specified by:
defaultReturnValue in interface Short2LongMap
Overrides:
defaultReturnValue in class AbstractShort2LongMap

put

public long put(short k,
                long v)
Description copied from interface: Short2LongMap
Adds a pair to the map.

Specified by:
put in interface Short2LongMap
Overrides:
put in class AbstractShort2LongMap

putAll

public void putAll(Short2LongMap c)

putAll

public void putAll(Map m)
Description copied from class: AbstractShort2LongMap
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 Map
Overrides:
putAll in class AbstractShort2LongMap
Parameters:
m - a map.

entrySet

public Set entrySet()
Specified by:
entrySet in interface Map

keySet

public Set keySet()
Description copied from class: AbstractShort2LongMap
Returns a type-specific-set view of the keys of this map.

The view is backed by the set returned by Map.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 Map
Overrides:
keySet in class AbstractShort2LongMap
Returns:
a set view of the keys of this map; it may be safely cast to a type-specific interface.

values

public Collection values()
Description copied from class: AbstractShort2LongMap
Returns a type-specific-set view of the values of this map.

The view is backed by the set returned by Map.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 Map
Overrides:
values in class AbstractShort2LongMap
Returns:
a set view of the values of this map; it may be safely cast to a type-specific interface.

clear

public void clear()
Specified by:
clear in interface Map
Overrides:
clear in class AbstractShort2LongMap

toString

public String toString()
Overrides:
toString in class AbstractShort2LongMap

put

public Object put(Object k,
                  Object v)
Description copied from class: AbstractShort2LongMap
Delegates to the corresponding type-specific method, taking care of returning null on a missing key.

This method must check whether the provided key is in the map using containsKey(). Thus, it probes the map twice. Implementors of subclasses should override it with a more efficient method.

Specified by:
put in interface Map
Overrides:
put in class AbstractShort2LongMap

remove

public long remove(short k)
Description copied from interface: Short2LongMap
Removes the mapping with the given key.

Specified by:
remove in interface Short2LongMap
Overrides:
remove in class AbstractShort2LongMap

get

public long get(short k)
Description copied from interface: Short2LongMap
Returns the value to which the given key is mapped.

Specified by:
get in interface Short2LongMap
Parameters:
k - the key.
Returns:
the corresponding value, or the default return value if no value was present for the given key.
See Also:
Map.get(Object)

containsKey

public boolean containsKey(Object ok)
Specified by:
containsKey in interface Map
Overrides:
containsKey in class AbstractShort2LongMap

containsValue

public boolean containsValue(Object ov)
Specified by:
containsValue in interface Map
Overrides:
containsValue in class AbstractShort2LongMap