BUG-7464: Refactor KVNode 23/49923/12
authorRobert Varga <rovarga@cisco.com>
Mon, 2 Jan 2017 03:29:09 +0000 (04:29 +0100)
committerRobert Varga <rovarga@cisco.com>
Tue, 10 Jan 2017 19:12:11 +0000 (20:12 +0100)
commit6c8920a2138a8a445e7478f5277a2c690cbb0ed6
treec3cfac64026fca7d89cc8d74575f5ac90b3827c1
parent0f68d6090d71ae30873e25f137c0e277ce1a2eb8
BUG-7464: Refactor KVNode

KVNode is not really useful, as it acts like a factory method
for turning SNode/TNode into an Map.Entry.

We do not compare those nodes based on identity, hence we can
safely make them implement immutable version of Entry interface.

In order to keep some safety, we retain the interface, renamed
to EntryNode, extending Map.Entry and providing a default
setValue() implementation.

This has the added benefit of not needing object allocation
during iteration.

Change-Id: I27e3049739f4eb97ee76e8462c9ddde3c4b5b17a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/EntryNode.java [moved from third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/KVNode.java with 61% similarity]
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/EntryUtil.java [new file with mode: 0644]
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/SNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/TNode.java
third-party/triemap/src/main/java/org/opendaylight/yangtools/triemap/TrieMap.java
third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/LNodeEntriesTest.java [moved from third-party/triemap/src/test/java/org/opendaylight/yangtools/triemap/ListMapTest.java with 97% similarity]