fabric.common.util
Interface LongKeyMap.Entry<V>

All Known Implementing Classes:
AbstractLongKeyMap.SimpleEntry, AbstractLongKeyMap.SimpleImmutableEntry
Enclosing interface:
LongKeyMap<V>

public static interface LongKeyMap.Entry<V>

A map entry (key-value pair). The Map.entrySet() method returns a set view of these objects; there is no other valid way to come across them. These objects are only valid for the duration of an iteration; in other words, if you mess with one after modifying the map, you are asking for undefined behavior.

Since:
1.2
Author:
Original author unknown, Eric Blake (ebb9@email.byu.edu)
See Also:
LongKeyMap, LongKeyMap.entrySet()

Method Summary
 boolean equals(java.lang.Object o)
          Compares the specified object with this entry.
 long getKey()
          Get the key corresponding to this entry.
 V getValue()
          Get the value corresponding to this entry.
 int hashCode()
          Returns the hash code of the entry.
 V setValue(V value)
          Replaces the value with the specified object (optional operation).
 

Method Detail

getKey

long getKey()
Get the key corresponding to this entry.

Returns:
the key

getValue

V getValue()
Get the value corresponding to this entry. If you already called Iterator.remove(), this is undefined.

Returns:
the value

setValue

V setValue(V value)
Replaces the value with the specified object (optional operation). This writes through to the map, and is undefined if you already called Iterator.remove().

Parameters:
value - the new value to store
Returns:
the old value
Throws:
java.lang.UnsupportedOperationException - if the operation is not supported
java.lang.ClassCastException - if the value is of the wrong type
java.lang.IllegalArgumentException - if something about the value prevents it from existing in this map
java.lang.NullPointerException - if the map forbids null values

hashCode

int hashCode()
Returns the hash code of the entry. This is defined as the exclusive-or of the hashcodes of the key and value (using 0 for null). In other words, this must be:

(getKey() == null ? 0 : getKey().hashCode())
^ (getValue() == null ? 0 : getValue().hashCode())

Overrides:
hashCode in class java.lang.Object
Returns:
the hash code

equals

boolean equals(java.lang.Object o)
Compares the specified object with this entry. Returns true only if the object is a mapping of identical key and value. In other words, this must be:

(o instanceof Map.Entry)
&& (getKey() == null ? ((Map.Entry) o).getKey() == null
                     : getKey().equals(((Map.Entry) o).getKey()))
&& (getValue() == null ? ((Map.Entry) o).getValue() == null
                       : getValue().equals(((Map.Entry) o).getValue()))

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare
Returns:
true if it is equal