public MainNode <K, V> removed(K k, ConcurrentTrieDictionary <K, V> ct) { ListMap <K, V> updmap = listmap.remove(k); if (updmap.size() > 1) { return(new LNode <K, V>(updmap)); } else { updmap.iterator().MoveNext(); KeyValuePair <K, V> kv = updmap.iterator().Current; // create it tombed so that it gets compressed on subsequent // accesses return(new TNode <K, V>(kv.Key, kv.Value, ct.computeHash(kv.Key))); } }
private ListMap <K, V> remove0(K key) { ListMap <K, V> n = this; ListMap <K, V> newN = null; ListMap <K, V> lastN = null; while (n != null) { if (n is EmptyListMap) { newN._next = n; break; } Node nn = (Node)n; if (key.Equals(nn.k)) { n = n._next; continue; } else { if (newN != null) { lastN._next = map(nn.k, nn.v, null); lastN = lastN._next; } else { newN = map(nn.k, nn.v, null); lastN = newN; } } n = n._next; } return(newN); }
public LNode(K k1, V v1, K k2, V v2) : this(ListMap <K, V> .map(k1, v1, k2, v2)) { }
public LNode(K k, V v) : this(ListMap <K, V> .map(k, v)) { }
public LNode(ListMap <K, V> listmap) { this.listmap = listmap; }
static public ListMap <K, V> map(K k, V v, ListMap <K, V> tail) { return(new Node(k, v, tail)); }
public NodeIterator(Node n) { this.n = n; }
public Node(K k, V v, ListMap <K, V> next) { this.k = k; this.v = v; _next = next; }