it.unimi.dsi.fastutil.floats
Class Float2IntFunctions.UnmodifiableFunction

java.lang.Object
  extended by it.unimi.dsi.fastutil.floats.AbstractFloat2IntFunction
      extended by it.unimi.dsi.fastutil.floats.Float2IntFunctions.UnmodifiableFunction
All Implemented Interfaces:
Float2IntFunction, Function<java.lang.Float,java.lang.Integer>, java.io.Serializable
Direct Known Subclasses:
Float2IntMaps.UnmodifiableMap
Enclosing class:
Float2IntFunctions

public static class Float2IntFunctions.UnmodifiableFunction
extends AbstractFloat2IntFunction
implements java.io.Serializable

An unmodifiable wrapper class for functions.

See Also:
Serialized Form

Method Summary
 void clear()
          Removes all associations from this function (optional operation).
 boolean containsKey(float k)
           
 boolean containsKey(java.lang.Object ok)
          Returns true if this function contains a mapping for the specified key.
 int defaultReturnValue()
          Gets the default return value.
 void defaultReturnValue(int defRetValue)
          Sets the default return value.
 int get(float k)
          Returns the value to which the given key is mapped.
 int put(float k, int v)
          Adds a pair to the map.
 int remove(float k)
          Removes the mapping with the given key.
 int size()
          Returns the intended number of keys in this function, or -1 if no such number exists.
 java.lang.String toString()
           
 
Methods inherited from class it.unimi.dsi.fastutil.floats.AbstractFloat2IntFunction
get, put, remove
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

size

public int size()
Description copied from interface: Function
Returns the intended number of keys in this function, or -1 if no such number exists.

Most function implementations will have some knowledge of the intended number of keys in their domain. In some cases, however, this might not be possible.

Specified by:
size in interface Function<java.lang.Float,java.lang.Integer>
Returns:
the intended number of keys in this function, or -1 if that number is not available.

containsKey

public boolean containsKey(float k)
Specified by:
containsKey in interface Float2IntFunction
See Also:
Function.containsKey(Object)

defaultReturnValue

public int defaultReturnValue()
Description copied from interface: Float2IntFunction
Gets the default return value.

Specified by:
defaultReturnValue in interface Float2IntFunction
Overrides:
defaultReturnValue in class AbstractFloat2IntFunction
Returns:
the current default return value.

defaultReturnValue

public void defaultReturnValue(int defRetValue)
Description copied from interface: Float2IntFunction
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 Float2IntFunction
Overrides:
defaultReturnValue in class AbstractFloat2IntFunction
Parameters:
defRetValue - the new default return value.
See Also:
Float2IntFunction.defaultReturnValue()

put

public int put(float k,
               int v)
Description copied from interface: Float2IntFunction
Adds a pair to the map.

Specified by:
put in interface Float2IntFunction
Overrides:
put in class AbstractFloat2IntFunction
Parameters:
k - the key.
v - the value.
Returns:
the old value, or the default return value if no value was present for the given key.
See Also:
Function.put(Object,Object)

clear

public void clear()
Description copied from interface: Function
Removes all associations from this function (optional operation).

Specified by:
clear in interface Function<java.lang.Float,java.lang.Integer>
Overrides:
clear in class AbstractFloat2IntFunction
See Also:
Map.clear()

toString

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

remove

public int remove(float k)
Description copied from interface: Float2IntFunction
Removes the mapping with the given key.

Specified by:
remove in interface Float2IntFunction
Overrides:
remove in class AbstractFloat2IntFunction
Returns:
the old value, or the default return value if no value was present for the given key.
See Also:
Function.remove(Object)

get

public int get(float k)
Description copied from interface: Float2IntFunction
Returns the value to which the given key is mapped.

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

containsKey

public boolean containsKey(java.lang.Object ok)
Description copied from interface: Function
Returns true if this function contains a mapping for the specified key.

Note that for some kind of functions (e.g., hashes) this method will always return true.

Specified by:
containsKey in interface Function<java.lang.Float,java.lang.Integer>
Overrides:
containsKey in class AbstractFloat2IntFunction
Parameters:
ok - the key.
Returns:
true if this function associates a value to key.
See Also:
Map.containsKey(Object)