return cleanReadOnly((TNode<K, V>) m, lev, parent, ct, k, hc);
} else if (m instanceof LNode) {
// 5) an l-node
- return ((LNode<K, V>) m).get(k);
+ return ((LNode<K, V>) m).get(k).orElse(null);
} else {
throw new IllegalStateException("Unhandled node " + m);
}
private Object cleanReadOnly(final TNode<K, V> tn, final int lev, final INode<K, V> parent,
final TrieMap<K, V> ct, final K k, final int hc) {
if (ct.nonReadOnly()) {
- // used to be throw RestartException
+ // used to be throw RestartException
clean(parent, ct, lev - 5);
return RESTART;
}
for (int i = 0; i < 10000; i++) {
assertNull(bt.put(Integer.valueOf(i), Integer.valueOf(i)));
- assertEquals(Integer.valueOf(i), bt.lookup(Integer.valueOf(i)));
+ assertEquals(Integer.valueOf(i), bt.get(Integer.valueOf(i)));
}
checkAddInsert(bt, 536);
for (int i = 0; i < 10000; i++) {
boolean removed = null != bt.remove(Integer.valueOf(i));
assertTrue(removed);
- final Object lookup = bt.lookup (Integer.valueOf(i));
+ final Object lookup = bt.get(Integer.valueOf(i));
assertNull(lookup);
}
private static void checkAddInsert (final TrieMap<Integer, Integer> bt, final int k) {
final Integer v = Integer.valueOf(k);
bt.remove (v);
- Object foundV = bt.lookup(v);
+ Integer foundV = bt.get(v);
assertNull(foundV);
assertNull(bt.put (v, v));
- foundV = bt.lookup(v);
+ foundV = bt.get(v);
assertEquals(v, foundV);
assertEquals(v, bt.put(v, Integer.valueOf(-1)));
}
private static void removeChars (final TrieMap<Object, Object> bt) {
- assertNotNull(bt.lookup('a'));
- assertNotNull(bt.lookup('b'));
- assertNotNull(bt.lookup('c'));
- assertNotNull(bt.lookup('d'));
- assertNotNull(bt.lookup('e'));
+ assertNotNull(bt.get('a'));
+ assertNotNull(bt.get('b'));
+ assertNotNull(bt.get('c'));
+ assertNotNull(bt.get('d'));
+ assertNotNull(bt.get('e'));
assertNotNull(bt.remove('a'));
assertNotNull(bt.remove('b'));
assertNull(bt.remove('d'));
assertNull(bt.remove('e'));
- assertNull(bt.lookup('a'));
- assertNull(bt.lookup('b'));
- assertNull(bt.lookup('c'));
- assertNull(bt.lookup('d'));
- assertNull(bt.lookup('e'));
+ assertNull(bt.get('a'));
+ assertNull(bt.get('b'));
+ assertNull(bt.get('c'));
+ assertNull(bt.get('d'));
+ assertNull(bt.get('e'));
}
private static void removeStrings (final TrieMap<Object, Object> bt) {
- assertNotNull(bt.lookup("a"));
- assertNotNull(bt.lookup("b"));
- assertNotNull(bt.lookup("c"));
- assertNotNull(bt.lookup("d"));
- assertNotNull(bt.lookup("e"));
+ assertNotNull(bt.get("a"));
+ assertNotNull(bt.get("b"));
+ assertNotNull(bt.get("c"));
+ assertNotNull(bt.get("d"));
+ assertNotNull(bt.get("e"));
assertNotNull(bt.remove("a"));
assertNotNull(bt.remove("b"));
assertNull(bt.remove("d"));
assertNull(bt.remove("e"));
- assertNull(bt.lookup("a"));
- assertNull(bt.lookup("b"));
- assertNull(bt.lookup("c"));
- assertNull(bt.lookup("d"));
- assertNull(bt.lookup("e"));
+ assertNull(bt.get("a"));
+ assertNull(bt.get("b"));
+ assertNull(bt.get("c"));
+ assertNull(bt.get("d"));
+ assertNull(bt.get("e"));
}
private static void removeInts (final TrieMap<Object, Object> bt) {
for (int i = 0; i < 128; i++) {
- final Integer bigI = Integer.valueOf (i);
- assertNotNull(bt.lookup(bigI));
+ final Integer bigI = Integer.valueOf(i);
+ assertNotNull(bt.get(bigI));
assertNotNull(bt.remove(bigI));
assertNull(bt.remove(bigI));
- assertNull(bt.lookup(bigI));
+ assertNull(bt.get(bigI));
}
}
private static void removeBytes (final TrieMap<Object, Object> bt) {
for (byte i = 0; i < 128 && i >= 0; i++) {
- final Byte bigB = Byte.valueOf (i);
- assertNotNull(bt.lookup(bigB));
+ final Byte bigB = Byte.valueOf(i);
+ assertNotNull(bt.get(bigB));
assertNotNull(bt.remove(bigB));
assertNull(bt.remove(bigB));
- assertNull(bt.lookup(bigB));
+ assertNull(bt.get(bigB));
}
}
}