Class UnmodifiableArrayBackedMap.UnmodifiableEntry

  • All Implemented Interfaces:
    java.util.Map.Entry<java.lang.String,​java.lang.String>
    Enclosing class:
    UnmodifiableArrayBackedMap

    private class UnmodifiableArrayBackedMap.UnmodifiableEntry
    extends java.lang.Object
    implements java.util.Map.Entry<java.lang.String,​java.lang.String>
    Implementation of Map.Entry. The implementation is simple since each instance contains an index in the array, then getKey() and getValue() retrieve from the array. Blocks modifications.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int index
      This field is functionally final, but marking it as such can cause performance problems.
    • Constructor Summary

      Constructors 
      Constructor Description
      UnmodifiableEntry​(int index)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getKey()  
      java.lang.String getValue()  
      int hashCode()
      Per spec, the hashcode is a function of the key and value.
      java.lang.String setValue​(java.lang.String value)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Map.Entry

        equals
    • Field Detail

      • index

        private int index
        This field is functionally final, but marking it as such can cause performance problems. Consider marking it final after https://bugs.openjdk.org/browse/JDK-8324186 is solved.
    • Constructor Detail

      • UnmodifiableEntry

        public UnmodifiableEntry​(int index)
    • Method Detail

      • getKey

        public java.lang.String getKey()
        Specified by:
        getKey in interface java.util.Map.Entry<java.lang.String,​java.lang.String>
      • getValue

        public java.lang.String getValue()
        Specified by:
        getValue in interface java.util.Map.Entry<java.lang.String,​java.lang.String>
      • hashCode

        public int hashCode()
        Per spec, the hashcode is a function of the key and value. Calculation exactly matches HashMap.
        Specified by:
        hashCode in interface java.util.Map.Entry<java.lang.String,​java.lang.String>
        Overrides:
        hashCode in class java.lang.Object
      • setValue

        public java.lang.String setValue​(java.lang.String value)
        Specified by:
        setValue in interface java.util.Map.Entry<java.lang.String,​java.lang.String>