Class Char2LongFunctions.SynchronizedFunction
- java.lang.Object
-
- it.unimi.dsi.fastutil.chars.Char2LongFunctions.SynchronizedFunction
-
- All Implemented Interfaces:
Char2LongFunction,Function<Character,Long>,Serializable,Function<Character,Long>,IntToLongFunction
- Direct Known Subclasses:
Char2LongMaps.SynchronizedMap
- Enclosing class:
- Char2LongFunctions
public static class Char2LongFunctions.SynchronizedFunction extends Object implements Char2LongFunction, Serializable
A synchronized wrapper class for functions.- See Also:
- Serialized Form
-
-
Method Summary
Modifier and Type Method Description Longapply(Character key)Deprecated.Please use the corresponding type-specific method instead.longapplyAsLong(int operand)Deprecated.Please use the corresponding type-specific method instead.voidclear()Removes all associations from this function (optional operation).booleancontainsKey(char k)Returns true if this function contains a mapping for the specified key.booleancontainsKey(Object k)Deprecated.longdefaultReturnValue()Gets the default return value.voiddefaultReturnValue(long defRetValue)Sets the default return value (optional operation).booleanequals(Object o)longget(char k)Returns the value to which the given key is mapped.Longget(Object k)Deprecated.Please use the corresponding type-specific method instead.inthashCode()longput(char k, long v)Adds a pair to the map (optional operation).Longput(Character k, Long v)Deprecated.Please use the corresponding type-specific method instead.longremove(char k)Removes the mapping with the given key (optional operation).Longremove(Object k)Deprecated.Please use the corresponding type-specific method instead.intsize()Returns the intended number of keys in this function, or -1 if no such number exists.StringtoString()
-
-
-
Method Detail
-
applyAsLong
@Deprecated public long applyAsLong(int operand)
Deprecated.Please use the corresponding type-specific method instead.In this default implementation, the key gets narrowed down to the actual key type, throwing an exception if the given key can't be represented in the restricted domain. This is done for interoperability with the Java 8 function environment. Its use is discouraged, as unexpected errors can occur. Instead, the corresponding classes should be used (e.g.,
Int2IntFunctioninstead ofShort2IntFunction).- Specified by:
applyAsLongin interfaceChar2LongFunction- Specified by:
applyAsLongin interfaceIntToLongFunction
-
apply
@Deprecated public Long apply(Character key)
Deprecated.Please use the corresponding type-specific method instead.This is equivalent to callingFunction.get(Object).- Specified by:
applyin interfaceFunction<Character,Long>- Specified by:
applyin interfaceFunction<Character,Long>- Parameters:
key-- Returns:
- See Also:
Function.apply(Object),Function.get(Object)
-
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.
-
defaultReturnValue
public long defaultReturnValue()
Description copied from interface:Char2LongFunctionGets 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 interfaceChar2LongFunction- Returns:
- the current default return value.
-
defaultReturnValue
public void defaultReturnValue(long defRetValue)
Description copied from interface:Char2LongFunctionSets 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 interfaceChar2LongFunction- Parameters:
defRetValue- the new default return value.- See Also:
Char2LongFunction.defaultReturnValue()
-
containsKey
public boolean containsKey(char k)
Description copied from interface:Char2LongFunctionReturns 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 interfaceChar2LongFunction- Parameters:
k- the key.- Returns:
- true if this function associates a value to
key. - See Also:
Function.containsKey(Object)
-
containsKey
@Deprecated public boolean containsKey(Object k)
Deprecated.Description copied from interface:Char2LongFunctionReturns 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. This default implementation, in particular, always return true.
- Specified by:
containsKeyin interfaceChar2LongFunction- Specified by:
containsKeyin interfaceFunction<Character,Long>- Parameters:
k- the key.- Returns:
- true if this function associates a value to
key. - See Also:
Map.containsKey(Object)
-
put
public long put(char k, long v)Description copied from interface:Char2LongFunctionAdds a pair to the map (optional operation).- Specified by:
putin interfaceChar2LongFunction- 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)
-
get
public long get(char k)
Description copied from interface:Char2LongFunctionReturns the value to which the given key is mapped.- Specified by:
getin interfaceChar2LongFunction- 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)
-
remove
public long remove(char k)
Description copied from interface:Char2LongFunctionRemoves the mapping with the given key (optional operation).- Specified by:
removein interfaceChar2LongFunction- Parameters:
k- the key.- Returns:
- the old value, or the default return value if no value was present for the given key.
- See Also:
Function.remove(Object)
-
clear
public void clear()
Description copied from interface:FunctionRemoves all associations from this function (optional operation).- Specified by:
clearin interfaceFunction<Character,Long>- See Also:
Map.clear()
-
put
@Deprecated public Long put(Character k, Long v)
Deprecated.Please use the corresponding type-specific method instead.Associates the specified value with the specified key in this function (optional operation).- Specified by:
putin interfaceChar2LongFunction- Specified by:
putin interfaceFunction<Character,Long>- Parameters:
k- the key.v- the value.- Returns:
- the old value, or
nullif no value was present for the given key. - See Also:
Map.put(Object,Object)
-
get
@Deprecated public Long get(Object k)
Deprecated.Please use the corresponding type-specific method instead.Returns the value associated by this function to the specified key.- Specified by:
getin interfaceChar2LongFunction- Specified by:
getin interfaceFunction<Character,Long>- Parameters:
k- the key.- Returns:
- the corresponding value, or
nullif no value was present for the given key. - See Also:
Map.get(Object)
-
remove
@Deprecated public Long remove(Object k)
Deprecated.Please use the corresponding type-specific method instead.Removes this key and the associated value from this function if it is present (optional operation).- Specified by:
removein interfaceChar2LongFunction- Specified by:
removein interfaceFunction<Character,Long>- Parameters:
k- the key.- Returns:
- the old value, or
nullif no value was present for the given key. - See Also:
Map.remove(Object)
-
-