Esempio n. 1
0
 // begin#fragment AVLTree2
 public Entry<K, V> remove(Entry<K, V> ent) throws InvalidEntryException {
   Entry<K, V> toReturn = super.remove(ent);
   if (toReturn != null) // we actually removed something
   rebalance(actionPos); // rebalance up the tree
   return toReturn;
 }
Esempio n. 2
0
 // begin#fragment AVLTree2
 public Entry<K, V> insert(K k, V v) throws InvalidKeyException {
   Entry<K, V> toReturn = super.insert(k, v); // calls our createNode method
   rebalance(actionPos); // rebalance up from the insertion position
   return toReturn;
 }