Package org.apache.groovy.json.internal
Class LazyMap
java.lang.Object
java.util.AbstractMap<java.lang.String,java.lang.Object>
org.apache.groovy.json.internal.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
-
Method Summary
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 Details
-
LazyMap
public LazyMap() -
LazyMap
public LazyMap(int initialSize)
-
-
Method Details
-
put
public java.lang.Object put(java.lang.String key, java.lang.Object value)- Specified by:
put
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
put
in classjava.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 interfacejava.util.Map<java.lang.String,java.lang.Object>
- Specified by:
entrySet
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
-
size
public int size()- Specified by:
size
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
size
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
isEmpty
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
-
containsValue
public boolean containsValue(java.lang.Object value)- Specified by:
containsValue
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
containsValue
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
-
containsKey
public boolean containsKey(java.lang.Object key)- Specified by:
containsKey
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
containsKey
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
-
get
public java.lang.Object get(java.lang.Object key)- Specified by:
get
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
get
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
-
remove
public java.lang.Object remove(java.lang.Object key)- Specified by:
remove
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
remove
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
-
putAll
public void putAll(java.util.Map m)- Specified by:
putAll
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
putAll
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
-
clear
public void clear()- Specified by:
clear
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
clear
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
-
keySet
public java.util.Set<java.lang.String> keySet()- Specified by:
keySet
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
keySet
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
-
values
public java.util.Collection<java.lang.Object> values()- Specified by:
values
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
values
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
-
equals
public boolean equals(java.lang.Object o)- Specified by:
equals
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
equals
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
hashCode
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
-
clone
protected java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clone
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
- Throws:
java.lang.CloneNotSupportedException
-
clearAndCopy
-
grow
public static <V> V[] grow(V[] array)
-