Package jodd.json
Class LazyMap
java.lang.Object
java.util.AbstractMap
jodd.json.LazyMap
- All Implemented Interfaces:
Map
This map 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.
Taken from Boon project (https://github.com/boonproject/boon)
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidvoidclear()protected Objectclone()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanprivate static <V> V[]grow(V[] array) inthashCode()booleanisEmpty()keySet()voidprivate static <V> Set<V> set(int size, V[] array) intsize()toString()values()Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
map
-
size
private int size -
keys
-
values
-
-
Constructor Details
-
LazyMap
LazyMap()
-
-
Method Details
-
put
- Specified by:
putin interfaceMap- Overrides:
putin classAbstractMap
-
entrySet
- Specified by:
entrySetin interfaceMap- Specified by:
entrySetin classAbstractMap
-
size
public int size()- Specified by:
sizein interfaceMap- Overrides:
sizein classAbstractMap
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceMap- Overrides:
isEmptyin classAbstractMap
-
containsValue
- Specified by:
containsValuein interfaceMap- Overrides:
containsValuein classAbstractMap
-
containsKey
- Specified by:
containsKeyin interfaceMap- Overrides:
containsKeyin classAbstractMap
-
get
- Specified by:
getin interfaceMap- Overrides:
getin classAbstractMap
-
buildIfNeeded
private void buildIfNeeded() -
remove
- Specified by:
removein interfaceMap- Overrides:
removein classAbstractMap
-
putAll
- Specified by:
putAllin interfaceMap- Overrides:
putAllin classAbstractMap
-
clear
public void clear()- Specified by:
clearin interfaceMap- Overrides:
clearin classAbstractMap
-
keySet
- Specified by:
keySetin interfaceMap- Overrides:
keySetin classAbstractMap
-
values
- Specified by:
valuesin interfaceMap- Overrides:
valuesin classAbstractMap
-
equals
- Specified by:
equalsin interfaceMap- Overrides:
equalsin classAbstractMap
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceMap- Overrides:
hashCodein classAbstractMap
-
toString
- Overrides:
toStringin classAbstractMap
-
clone
- Overrides:
clonein classAbstractMap
-
set
-
grow
private static <V> V[] grow(V[] array)
-