mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-23 00:24:11 -08:00
Probably fix https://github.com/konsoletyper/teavm/issues/112
This commit is contained in:
parent
07b65a92c7
commit
639633018e
|
@ -363,9 +363,9 @@ public class TTreeMap<K, V> extends TAbstractMap<K, V> implements TCloneable, TS
|
||||||
while (minDepth > 0) {
|
while (minDepth > 0) {
|
||||||
TreeNode<K, V> node = pathToMin[--minDepth];
|
TreeNode<K, V> node = pathToMin[--minDepth];
|
||||||
node.left = right;
|
node.left = right;
|
||||||
right = node;
|
|
||||||
node.fix();
|
node.fix();
|
||||||
node.balance();
|
node = node.balance();
|
||||||
|
right = node;
|
||||||
}
|
}
|
||||||
min.right = right;
|
min.right = right;
|
||||||
min.left = left;
|
min.left = left;
|
||||||
|
|
|
@ -639,4 +639,19 @@ public class TreeMapTest {
|
||||||
}
|
}
|
||||||
return treeMap;
|
return treeMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void deletesProperly() {
|
||||||
|
TreeMap<Integer, Integer> tm = new TreeMap<>();
|
||||||
|
for (int i = 0; i <= 100; ++i) {
|
||||||
|
tm.put(i, i);
|
||||||
|
}
|
||||||
|
for (int i = 0; i <= 100; ++i) {
|
||||||
|
Integer removed = tm.remove(i);
|
||||||
|
assertEquals(Integer.valueOf(i), removed);
|
||||||
|
tm.put(i, i + 1);
|
||||||
|
assertTrue("13 is expected to be in the map: " + i, tm.containsKey(13));
|
||||||
|
assertTrue("99 is expected to be in the map: " + i, tm.containsKey(99));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user