Package it.unimi.dsi.fastutil.shorts
Class Short2BooleanFunctions.EmptyFunction
java.lang.Object
it.unimi.dsi.fastutil.shorts.AbstractShort2BooleanFunction
it.unimi.dsi.fastutil.shorts.Short2BooleanFunctions.EmptyFunction
- All Implemented Interfaces:
Function<java.lang.Short,java.lang.Boolean>,Short2BooleanFunction,java.io.Serializable,java.lang.Cloneable,java.util.function.Function<java.lang.Short,java.lang.Boolean>,java.util.function.IntPredicate
- Direct Known Subclasses:
Short2BooleanMaps.EmptyMap
- Enclosing class:
- Short2BooleanFunctions
public static class Short2BooleanFunctions.EmptyFunction extends AbstractShort2BooleanFunction implements java.io.Serializable, java.lang.Cloneable
An immutable class representing an empty type-specific function.
This class may be useful to implement your own in case you subclass a type-specific function.
- See Also:
- Serialized Form
-
Method Summary
Modifier and Type Method Description voidclear()Removes all associations from this function (optional operation).java.lang.Objectclone()booleancontainsKey(short k)Returns true if this function contains a mapping for the specified key.booleandefaultReturnValue()Gets the default return value.voiddefaultReturnValue(boolean defRetValue)Sets the default return value (optional operation).booleanequals(java.lang.Object o)booleanget(short k)Returns the value to which the given key is mapped.booleangetOrDefault(short k, boolean defaultValue)Returns the value associated by this function to the specified key, or give the specified value if not present.inthashCode()intsize()Returns the intended number of keys in this function, or -1 if no such number exists.java.lang.StringtoString()Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.function.IntPredicate
and, negate, orMethods inherited from interface it.unimi.dsi.fastutil.shorts.Short2BooleanFunction
andThen, andThenByte, andThenChar, andThenDouble, andThenFloat, andThenInt, andThenLong, andThenObject, andThenReference, andThenShort, compose, composeByte, composeChar, composeDouble, composeFloat, composeInt, composeLong, composeObject, composeReference, composeShort, containsKey, get, getOrDefault, put, put, remove, remove, test
-
Method Details
-
get
public boolean get(short k)Description copied from interface:Short2BooleanFunctionReturns the value to which the given key is mapped.- Specified by:
getin interfaceShort2BooleanFunction- 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)
-
getOrDefault
public boolean getOrDefault(short k, boolean defaultValue)Description copied from interface:Short2BooleanFunctionReturns the value associated by this function to the specified key, or give the specified value if not present.- Specified by:
getOrDefaultin interfaceShort2BooleanFunction- Parameters:
k- the key.defaultValue- the value to return if not present.- Returns:
- the corresponding value, or
defaultValueif no value was present for the given key. - See Also:
Function.getOrDefault(Object, Object)
-
containsKey
public boolean containsKey(short k)Description copied from interface:Short2BooleanFunctionReturns 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. In particular, this default implementation always returns true.
- Specified by:
containsKeyin interfaceShort2BooleanFunction- Parameters:
k- the key.- Returns:
- true if this function associates a value to
key. - See Also:
Function.containsKey(Object)
-
defaultReturnValue
public boolean defaultReturnValue()Description copied from interface:Short2BooleanFunctionGets the default return value.This default implementation just return the default null value of the type (
nullfor objects, 0 for scalars, false for Booleans).- Specified by:
defaultReturnValuein interfaceShort2BooleanFunction- Overrides:
defaultReturnValuein classAbstractShort2BooleanFunction- Returns:
- the current default return value.
-
defaultReturnValue
public void defaultReturnValue(boolean defRetValue)Description copied from interface:Short2BooleanFunctionSets the default return value (optional operation). This value must be returned by type-specific versions ofget(),put()andremove()to denote that the map does not contain the specified key. It must be 0/false/nullby default.- Specified by:
defaultReturnValuein interfaceShort2BooleanFunction- Overrides:
defaultReturnValuein classAbstractShort2BooleanFunction- Parameters:
defRetValue- the new default return value.- See Also:
Short2BooleanFunction.defaultReturnValue()
-
size
public int size()Description copied from interface:FunctionReturns 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. This default implementation, in particular, returns -1.
-
clear
public void clear()Description copied from interface:FunctionRemoves all associations from this function (optional operation). -
clone
public java.lang.Object clone() -
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-