java.lang.Object
me.sbasalaev.collection.Entry<K,V>
- Type Parameters:
K- type of the key.V- type of the value.
Map entry.
Associates key with value.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether given object is equal to this entry.inthashCode()The hash code for this entry.abstract Kkey()The key of this entry.intkeyHash()Returns the hash code of the key.static <K,V> Entry <K, V> of(K key, V value) Returns map entry with given key and value.toString()String representation of this entry.abstract Vvalue()The value associated with the key in this entry.
-
Constructor Details
-
Entry
public Entry()Constructor for subclasses.
-
-
Method Details
-
of
Returns map entry with given key and value. The entry is immutable and caches key hash. -
key
The key of this entry. -
value
The value associated with the key in this entry. -
keyHash
public int keyHash()Returns the hash code of the key. May be overriden if caching the hash is desired. -
equals
Whether given object is equal to this entry. Two entries are equal if they contain the same keys and values. -
hashCode
public int hashCode()The hash code for this entry. -
toString
String representation of this entry. Returns string of the formkey => value
-