public class LazyMap
extends AbstractMap
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.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
clear()Clears the compact buffers or hydrated map, depending on the current state. |
|
public LazyMap |
clearAndCopy()Copies the compact entries into a new LazyMap and clears this instance. |
|
protected Object |
clone()Clones the hydrated backing map when one already exists. |
|
public boolean |
containsKey(Object key)Hydrates the backing map if needed and tests whether the key is present. |
|
public boolean |
containsValue(Object value)Hydrates the backing map if needed and tests whether the value is present. |
|
public Set<Entry<String, Object>> |
entrySet()Returns the hydrated entry set, building the backing map if necessary. |
|
public boolean |
equals(Object o)Hydrates the backing map if needed and compares it with another object. |
|
public Object |
get(Object key)Hydrates the backing map if needed and returns the value for the supplied key. |
<V> |
public static V[] |
grow(V[] array)Doubles the capacity of the supplied array while preserving its component type. |
|
public int |
hashCode()Hydrates the backing map if needed and returns its hash code. |
|
public boolean |
isEmpty()Returns whether the map currently contains any entries. |
|
public Set<String> |
keySet()Hydrates the backing map if needed and returns its key set. |
|
public Object |
put(String key, Object value)Stores a mapping while keeping the compact array-backed representation until hydration is needed. |
|
public void |
putAll(Map m)Hydrates the backing map if needed and copies all supplied entries into it. |
|
public Object |
remove(Object key)Hydrates the backing map if needed and removes the supplied key. |
|
public int |
size()Returns the current size without hydrating when the compact representation is still active. |
|
public String |
toString()Hydrates the backing map if needed and returns its string form. |
|
public Collection<Object> |
values()Hydrates the backing map if needed and returns its values collection. |
| Methods inherited from class | Name |
|---|---|
class AbstractMap |
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getClass, getOrDefault, hashCode, isEmpty, keySet, merge, notify, notifyAll, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, toString, values, wait, wait, wait |
Creates a lazy map with the default key and value buffer size.
Creates a lazy map with a caller-supplied key and value buffer size.
initialSize - initial buffer sizeClears the compact buffers or hydrated map, depending on the current state.
Copies the compact entries into a new LazyMap and clears this instance.
Clones the hydrated backing map when one already exists.
null when still compactHydrates the backing map if needed and tests whether the key is present.
key - key to testtrue when the key is presentHydrates the backing map if needed and tests whether the value is present.
value - value to testtrue when the value is presentReturns the hydrated entry set, building the backing map if necessary.
Hydrates the backing map if needed and compares it with another object.
o - other objecttrue when equalHydrates the backing map if needed and returns the value for the supplied key.
key - key to look upnullDoubles the capacity of the supplied array while preserving its component type.
array - array to growV - component typeHydrates the backing map if needed and returns its hash code.
Returns whether the map currently contains any entries.
true when no entries are storedHydrates the backing map if needed and returns its key set.
Stores a mapping while keeping the compact array-backed representation until hydration is needed.
key - entry keyvalue - entry valuekey, or nullHydrates the backing map if needed and copies all supplied entries into it.
m - entries to copyHydrates the backing map if needed and removes the supplied key.
key - key to removenullReturns the current size without hydrating when the compact representation is still active.
Hydrates the backing map if needed and returns its string form.
Hydrates the backing map if needed and returns its values collection.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.