public static class Object2LongMaps.EmptyMap<K> extends Object2LongFunctions.EmptyFunction<K> implements Object2LongMap<K>, Serializable, Cloneable
This class may be useful to implement your own in case you subclass a type-specific map.
|Modifier and Type||Method and Description|
Creates and returns a copy of this object.
Please use the corresponding type-specific method instead.
Indicates whether some other object is "equal to" this one.
Returns a hash code value for the object.
Returns true if this map contains no key-value mappings.
Returns a type-specific set view of the mappings contained in this map.
Copies all of the mappings from the specified map to this map (optional operation).
Returns a string representation of the object.
clear, containsKey, defaultReturnValue, defaultReturnValue, getLong, size
clear, computeLong, computeLongIfAbsent, computeLongIfAbsentPartial, computeLongIfPresent, containsKey, defaultReturnValue, defaultReturnValue, entrySet, get, getOrDefault, getOrDefault, merge, mergeLong, put, putIfAbsent, putIfAbsent, remove, remove, remove, replace, replace, replace, replace, size
applyAsLong, getLong, put, removeLong
public boolean containsValue(long v)
trueif this map maps one or more keys to the specified value.
@Deprecated public boolean containsValue(Object ov)
put(k, v)on this map once for each mapping from key k to value v in the specified map. The behavior of this operation is undefined if the specified map is modified while the operation is in progress.
public ObjectSet<Object2LongMap.Entry<K>> object2LongEntrySet()
This method is necessary because there is no inheritance along type
parameters: it is thus impossible to strengthen
that it returns an
type-specific entries (the latter makes it possible to access keys and
values with type-specific methods).
Setview of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.
Note that this specification strengthens the one given in
public LongCollection values()
Collectionview of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. If the map is modified while an iteration over the collection is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The collection supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Collection.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.
Note that this specification strengthens the one given in
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 boolean isEmpty()
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())