Class AbstractMapEntry<K,V>

java.lang.Object
org.apache.sis.internal.util.AbstractMapEntry<K,V>
Type Parameters:
K - the type of keys maintained by the map.
V - the type of mapped values.
All Implemented Interfaces:
Map.Entry<K,V>
Direct Known Subclasses:
CharacteristicMap.Entry, DefaultRecord.Entry, ValueMap.Property

public abstract class AbstractMapEntry<K,V> extends Object implements Map.Entry<K,V>
Provides default implementations of equals(Object), hashCode() and toString() for a map entry.
Since:
0.5
Version:
0.5
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    For subclasses constructors.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object object)
    Compares the specified object with this entry for equality.
    (package private) static String
    Returns only the first line of the string representation of the given value.
    int
    Returns the hash code value for this map entry.
    setValue(V value)
    Sets the value corresponding to this entry (optional operation).
    Returns a string representation of this entry.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.util.Map.Entry

    getKey, getValue
  • Constructor Details

    • AbstractMapEntry

      protected AbstractMapEntry()
      For subclasses constructors.
  • Method Details

    • setValue

      public V setValue(V value)
      Sets the value corresponding to this entry (optional operation). The default implementation throws UnsupportedOperationException for the convenience of unmodifiable map implementations.
      Specified by:
      setValue in interface Map.Entry<K,V>
      Parameters:
      value - the new value to be stored in this entry.
      Returns:
      the previous value (may be null).
      Throws:
      UnsupportedOperationException - if this entry is unmodifiable.
    • equals

      public boolean equals(Object object)
      Compares the specified object with this entry for equality. Criterion are specified by the Map.Entry contract.
      Specified by:
      equals in interface Map.Entry<K,V>
      Overrides:
      equals in class Object
      Parameters:
      object - the other object to compare with this entry.
    • hashCode

      public int hashCode()
      Returns the hash code value for this map entry. The formula is specified by the Map.Entry contract.
      Specified by:
      hashCode in interface Map.Entry<K,V>
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns a string representation of this entry. If the string representation of the value uses more than one line, then only the first line is shown. This method is mostly for debugging purpose.
      Overrides:
      toString in class Object
    • firstLine

      static String firstLine(Object value)
      Returns only the first line of the string representation of the given value.
      Parameters:
      value - the value for which to get a string representation.
      Returns:
      the first line of the string representation of the given value.