*/
package org.opendaylight.yangtools.triemap;
+import java.util.Iterator;
import java.util.Map.Entry;
-final class LNode<K, V> extends MainNode<K, V> {
- final ListMap<K, V> listmap;
+final class LNode<K, V> extends MainNode<K, V> implements Iterable<Entry<K, V>> {
+ private final ListMap<K, V> listmap;
- LNode(final ListMap<K, V> listmap) {
+ private LNode(final ListMap<K, V> listmap) {
this.listmap = listmap;
}
- LNode(final K k, final V v) {
- this(ListMap.map(k, v));
- }
-
LNode(final K k1, final V v1, final K k2, final V v2) {
this(ListMap.map(k1, v1, k2, v2));
}
LNode<K, V> inserted(final K k, final V v) {
- return new LNode<> (listmap.add (k, v));
+ return new LNode<>(listmap.add(k, v));
}
- MainNode<K, V> removed (final K k, final TrieMap<K, V> ct) {
- ListMap<K, V> updmap = listmap.remove(k);
- if (updmap.size () > 1) {
- return new LNode<> (updmap);
+ MainNode<K, V> removed(final K k, final TrieMap<K, V> ct) {
+ final ListMap<K, V> updmap = listmap.remove(k);
+ if (updmap.size() > 1) {
+ return new LNode<>(updmap);
}
final Entry<K, V> kv = updmap.iterator().next();
}
@Override
- public int cachedSize(final Object ct) {
+ int cachedSize(final TrieMap<K, V> ct) {
return listmap.size();
}
// (" " * lev) + "LNode(%s)".format(listmap.mkString(", "))
return "LNode";
}
+
+ @Override
+ public Iterator<Entry<K, V>> iterator() {
+ return listmap.iterator();
+ }
}
\ No newline at end of file