mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Fix updating size in LinkedList.remove (fix #226).
This commit is contained in:
parent
2a3b0cd597
commit
8c3f071f88
|
@ -348,7 +348,6 @@ public class TLinkedList<E> extends TAbstractSequentialList<E> implements TDeque
|
|||
} else if (currentEntry == nextEntry) {
|
||||
nextEntry = hasPrevious() ? prevEntry.next : null;
|
||||
}
|
||||
--size;
|
||||
version = modCount;
|
||||
currentEntry = null;
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ public class LinkedListTest {
|
|||
assertEquals(2, iter.nextIndex());
|
||||
assertEquals("a", iter.next());
|
||||
assertArrayEquals(new String[] { "1", "2", "a", "b" }, list.toArray(new String[0]));
|
||||
assertEquals(4, list.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -138,6 +139,7 @@ public class LinkedListTest {
|
|||
iter.remove();
|
||||
assertEquals(1, iter.nextIndex());
|
||||
assertEquals("3", iter.next());
|
||||
assertEquals(4, list.size());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
|
@ -195,7 +197,7 @@ public class LinkedListTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void removesFirstOccurence() {
|
||||
public void removesFirstOccurrence() {
|
||||
LinkedList<String> list = new LinkedList<>();
|
||||
list.addAll(Arrays.asList("1", "2", "3", "1", "2"));
|
||||
assertFalse(list.removeFirstOccurrence("*"));
|
||||
|
@ -205,7 +207,7 @@ public class LinkedListTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void removesLastOccurence() {
|
||||
public void removesLastOccurrence() {
|
||||
LinkedList<String> list = new LinkedList<>();
|
||||
list.addAll(Arrays.asList("1", "2", "3", "1", "2"));
|
||||
assertFalse(list.removeLastOccurrence("*"));
|
||||
|
|
Loading…
Reference in New Issue
Block a user