Package org.opendaylight.yangtools.util
Class MapAdaptor
java.lang.Object
org.opendaylight.yangtools.util.MapAdaptor
A simple layer on top of maps, which performs snapshot mediation and optimization of
what the underlying implementation is.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic MapAdaptor
Return the default-configured instance.static MapAdaptor
getInstance
(boolean useSingleton, int copyMaxItems, int persistMinItems) <K,
V> Map <K, V> initialSnapshot
(int expectedSize) Creates an initial snapshot.<K,
V> Map <K, V> Input will be thrown away, result will be retained for read-only access ortakeSnapshot(Map)
purposes.<K,
V> Map <K, V> takeSnapshot
(Map<K, V> input) Input is treated is supposed to be left unmodified, result must be mutable.
-
Field Details
-
DEFAULT_COPY_MAX_ITEMS
public static final int DEFAULT_COPY_MAX_ITEMS- See Also:
-
COPY_MAX_ITEMS_MAX_PROP
- See Also:
-
DEFAULT_PERSIST_MIN_ITEMS
public static final int DEFAULT_PERSIST_MIN_ITEMS- See Also:
-
PERSIST_MIN_ITEMS_PROP
- See Also:
-
-
Method Details
-
getDefaultInstance
Return the default-configured instance.- Returns:
- the singleton global instance
-
getInstance
-
initialSnapshot
Creates an initial snapshot. The backing map is selected according to the expected size.- Parameters:
expectedSize
- Expected map size- Returns:
- An empty mutable map.
-
takeSnapshot
Input is treated is supposed to be left unmodified, result must be mutable.- Parameters:
input
- input map- Returns:
- An isolated, read-write snapshot of input map
- Throws:
NullPointerException
- if input is null
-
optimize
Input will be thrown away, result will be retained for read-only access ortakeSnapshot(Map)
purposes.- Parameters:
input
- non-optimized (read-write) map- Returns:
- optimized read-only map
- Throws:
NullPointerException
- if input is null
-