Class LazyMap

  • All Implemented Interfaces:
    java.util.Map<java.lang.String,​java.lang.Object>

    public class LazyMap
    extends java.util.AbstractMap<java.lang.String,​java.lang.Object>
    This maps only builds once you ask for a key for the first time. It is designed to not incur the overhead of creating a map unless needed.
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      LazyMap()  
      LazyMap​(int initialSize)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      LazyMap clearAndCopy()  
      protected java.lang.Object clone()  
      boolean containsKey​(java.lang.Object key)  
      boolean containsValue​(java.lang.Object value)  
      java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.Object>> entrySet()  
      boolean equals​(java.lang.Object o)  
      java.lang.Object get​(java.lang.Object key)  
      static <V> V[] grow​(V[] array)  
      int hashCode()  
      boolean isEmpty()  
      java.util.Set<java.lang.String> keySet()  
      java.lang.Object put​(java.lang.String key, java.lang.Object value)  
      void putAll​(java.util.Map m)  
      java.lang.Object remove​(java.lang.Object key)  
      int size()  
      java.lang.String toString()  
      java.util.Collection<java.lang.Object> values()  
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Constructor Detail

      • LazyMap

        public LazyMap()
      • LazyMap

        public LazyMap​(int initialSize)
    • Method Detail

      • put

        public java.lang.Object put​(java.lang.String key,
                                    java.lang.Object value)
        Specified by:
        put in interface java.util.Map<java.lang.String,​java.lang.Object>
        Overrides:
        put in class java.util.AbstractMap<java.lang.String,​java.lang.Object>
      • entrySet

        public java.util.Set<java.util.Map.Entry<java.lang.String,​java.lang.Object>> entrySet()
        Specified by:
        entrySet in interface java.util.Map<java.lang.String,​java.lang.Object>
        Specified by:
        entrySet in class java.util.AbstractMap<java.lang.String,​java.lang.Object>
      • size

        public int size()
        Specified by:
        size in interface java.util.Map<java.lang.String,​java.lang.Object>
        Overrides:
        size in class java.util.AbstractMap<java.lang.String,​java.lang.Object>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Map<java.lang.String,​java.lang.Object>
        Overrides:
        isEmpty in class java.util.AbstractMap<java.lang.String,​java.lang.Object>
      • containsValue

        public boolean containsValue​(java.lang.Object value)
        Specified by:
        containsValue in interface java.util.Map<java.lang.String,​java.lang.Object>
        Overrides:
        containsValue in class java.util.AbstractMap<java.lang.String,​java.lang.Object>
      • containsKey

        public boolean containsKey​(java.lang.Object key)
        Specified by:
        containsKey in interface java.util.Map<java.lang.String,​java.lang.Object>
        Overrides:
        containsKey in class java.util.AbstractMap<java.lang.String,​java.lang.Object>
      • get

        public java.lang.Object get​(java.lang.Object key)
        Specified by:
        get in interface java.util.Map<java.lang.String,​java.lang.Object>
        Overrides:
        get in class java.util.AbstractMap<java.lang.String,​java.lang.Object>
      • remove

        public java.lang.Object remove​(java.lang.Object key)
        Specified by:
        remove in interface java.util.Map<java.lang.String,​java.lang.Object>
        Overrides:
        remove in class java.util.AbstractMap<java.lang.String,​java.lang.Object>
      • putAll

        public void putAll​(java.util.Map m)
        Specified by:
        putAll in interface java.util.Map<java.lang.String,​java.lang.Object>
        Overrides:
        putAll in class java.util.AbstractMap<java.lang.String,​java.lang.Object>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Map<java.lang.String,​java.lang.Object>
        Overrides:
        clear in class java.util.AbstractMap<java.lang.String,​java.lang.Object>
      • keySet

        public java.util.Set<java.lang.String> keySet()
        Specified by:
        keySet in interface java.util.Map<java.lang.String,​java.lang.Object>
        Overrides:
        keySet in class java.util.AbstractMap<java.lang.String,​java.lang.Object>
      • values

        public java.util.Collection<java.lang.Object> values()
        Specified by:
        values in interface java.util.Map<java.lang.String,​java.lang.Object>
        Overrides:
        values in class java.util.AbstractMap<java.lang.String,​java.lang.Object>
      • equals

        public boolean equals​(java.lang.Object o)
        Specified by:
        equals in interface java.util.Map<java.lang.String,​java.lang.Object>
        Overrides:
        equals in class java.util.AbstractMap<java.lang.String,​java.lang.Object>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Map<java.lang.String,​java.lang.Object>
        Overrides:
        hashCode in class java.util.AbstractMap<java.lang.String,​java.lang.Object>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.util.AbstractMap<java.lang.String,​java.lang.Object>
      • clone

        protected java.lang.Object clone()
                                  throws java.lang.CloneNotSupportedException
        Overrides:
        clone in class java.util.AbstractMap<java.lang.String,​java.lang.Object>
        Throws:
        java.lang.CloneNotSupportedException
      • clearAndCopy

        public LazyMap clearAndCopy()
      • grow

        public static <V> V[] grow​(V[] array)