it.unimi.dsi.fastutil.floats
Interface Float2ByteFunction

All Superinterfaces:
Function<Float,Byte>
All Known Subinterfaces:
Float2ByteMap, Float2ByteSortedMap
All Known Implementing Classes:
AbstractFloat2ByteFunction, AbstractFloat2ByteMap, AbstractFloat2ByteSortedMap, Float2ByteArrayMap, Float2ByteAVLTreeMap, Float2ByteFunctions.EmptyFunction, Float2ByteFunctions.Singleton, Float2ByteFunctions.SynchronizedFunction, Float2ByteFunctions.UnmodifiableFunction, Float2ByteLinkedOpenHashMap, Float2ByteMaps.EmptyMap, Float2ByteMaps.Singleton, Float2ByteMaps.SynchronizedMap, Float2ByteMaps.UnmodifiableMap, Float2ByteOpenHashMap, Float2ByteRBTreeMap, Float2ByteSortedMaps.EmptySortedMap, Float2ByteSortedMaps.Singleton, Float2ByteSortedMaps.SynchronizedSortedMap, Float2ByteSortedMaps.UnmodifiableSortedMap

public interface Float2ByteFunction
extends Function<Float,Byte>

A type-specific Function; provides some additional methods that use polymorphism to avoid (un)boxing.

Type-specific versions of get(), put() and remove() cannot rely on null to denote absence of a key. Rather, they return a default return value, which is set to 0 cast to the return type (false for booleans) at creation, but can be changed using the defaultReturnValue() method.

For uniformity reasons, even maps returning objects implement the default return value (of course, in this case the default return value is initialized to null).

Warning: to fall in line as much as possible with the standard map interface, it is strongly suggested that standard versions of get(), put() and remove() for maps with primitive-type values return null to denote missing keys rather than wrap the default return value in an object (of course, for maps with object keys and values this is not possible, as there is no type-specific version).

See Also:
Function

Method Summary
 boolean containsKey(float key)
           
 byte defaultReturnValue()
          Gets the default return value.
 void defaultReturnValue(byte rv)
          Sets the default return value.
 byte get(float key)
          Returns the value to which the given key is mapped.
 byte put(float key, byte value)
          Adds a pair to the map.
 byte remove(float key)
          Removes the mapping with the given key.
 
Methods inherited from interface it.unimi.dsi.fastutil.Function
clear, containsKey, get, put, remove, size
 

Method Detail

put

byte put(float key,
         byte value)
Adds a pair to the map.

Parameters:
key - the key.
value - 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)

get

byte get(float key)
Returns the value to which the given key is mapped.

Parameters:
key - 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)

remove

byte remove(float key)
Removes the mapping with the given key.

Parameters:
key -
Returns:
the old value, or the default return value if no value was present for the given key.
See Also:
Function.remove(Object)

containsKey

boolean containsKey(float key)
See Also:
Function.containsKey(Object)

defaultReturnValue

void defaultReturnValue(byte rv)
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.

Parameters:
rv - the new default return value.
See Also:
defaultReturnValue()

defaultReturnValue

byte defaultReturnValue()
Gets the default return value.

Returns:
the current default return value.