Introduce MapAdaptor.initialSnapshot() 67/22667/2
authorRobert Varga <rovarga@cisco.com>
Mon, 15 Jun 2015 22:28:54 +0000 (00:28 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 16 Jun 2015 07:51:10 +0000 (07:51 +0000)
commit912b086d2fa98dcc9224cc7635701e6e52dc8ffb
tree31b380b2708c7e0773767a1e085b669834874614
parent68351cc3fd4d08a7fb4dc37812539fba7492ae92
Introduce MapAdaptor.initialSnapshot()

In some circumstances we have an idea about how many entries will there
be in a map. This could cost us perform one additional copy, so expose a
method to create the appropriate map, behaving just as the one returned
by takeSnapshot(Collections.emptyMap()).

Also use ImmutableMaps for empty map, as it being immutable is recognized
by Guava, leading to quick reuse.

Change-Id: I40925e5d643c074277e9d11365a3b10fb9f22c1d
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 92fc5cc4436a65c3a63e1fc7afbff2ac42a70880)
common/util/src/main/java/org/opendaylight/yangtools/util/MapAdaptor.java
common/util/src/main/java/org/opendaylight/yangtools/util/ReadWriteTrieMap.java
common/util/src/test/java/org/opendaylight/yangtools/util/MapAdaptorTest.java