public static class Short2IntFunctions.EmptyFunction extends AbstractShort2IntFunction implements Serializable, Cloneable
This class may be useful to implement your own in case you subclass a type-specific function.
|Modifier and Type||Method and Description|
Creates and returns a copy of this object.
Returns true if this function contains a mapping for the specified key.
Gets the default return value.
Sets the default return value (optional operation).
Indicates whether some other object is "equal to" this one.
Returns the value to which the given key is mapped.
Returns a hash code value for the object.
Returns a string representation of the object.
applyAsInt, containsKey, get, put, put, remove, remove
public int get(short k)
public boolean containsKey(short k)
Note that for some kind of functions (e.g., hashes) this method will always return true. In particular, this default implementation always returns true.
public int defaultReturnValue()
This default implementation just return the default null value of the
null for objects, 0 for scalars, false for Booleans).
public void defaultReturnValue(int defRetValue)
remove()to denote that the map does not contain the specified key. It must be 0/
public int size()
public void clear()
public Object clone()
x, the expression:
will be true, and that the expression:x.clone() != x
will bex.clone().getClass() == x.getClass()
true, but these are not absolute requirements. While it is typically the case that:
true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
super.clone. If a class and all of its superclasses (except
Object) obey this convention, it will be the case that
x.clone().getClass() == x.getClass().
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
super.clone before returning it. Typically, this means
copying any mutable objects that comprise the internal "deep structure"
of the object being cloned and replacing the references to these
objects with references to the copies. If a class contains only
primitive fields or references to immutable objects, then it is usually
the case that no fields in the object returned by
need to be modified.
clone for class
Object performs a
specific cloning operation. First, if the class of this object does
not implement the interface
Cloneable, then a
CloneNotSupportedException is thrown. Note that all arrays
are considered to implement the interface
Cloneable and that
the return type of the
clone method of an array type
T where T is any reference or primitive type.
Otherwise, this method creates a new instance of the class of this
object and initializes all its fields with exactly the contents of
the corresponding fields of this object, as if by assignment; the
contents of the fields are not themselves cloned. Thus, this method
performs a "shallow copy" of this object, not a "deep copy" operation.
Object does not itself implement the interface
Cloneable, so calling the
clone method on an object
whose class is
Object will result in throwing an
exception at run time.
public int hashCode()
The general contract of
hashCodemethod must consistently return the same integer, provided no information used in
equalscomparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
equals(Object)method, then calling the
hashCodemethod on each of the two objects must produce the same integer result.
Object.equals(java.lang.Object)method, then calling the
hashCodemethod on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by
Object does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
Java™ programming language.)
public boolean equals(Object o)
equals method implements an equivalence relation
on non-null object references:
trueif and only if
y, multiple invocations of
trueor consistently return
false, provided no information used in
equalscomparisons on the objects is modified.
equals method for class
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values
y, this method returns
true if and only
y refer to the same object
x == y has the value
Note that it is generally necessary to override the
method whenever this method is overridden, so as to maintain the
general contract for the
hashCode method, which states
that equal objects must have equal hash codes.
public String toString()
toStringmethod returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
toString method for class
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
getClass().getName() + '@' + Integer.toHexString(hashCode())