mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
classlib: fix for positioned addAll in sequential lists (#824)
This commit is contained in:
parent
5bc398415d
commit
1900852cd8
|
@ -72,7 +72,6 @@ public abstract class TAbstractSequentialList<E> extends TAbstractList<E> {
|
||||||
boolean added = false;
|
boolean added = false;
|
||||||
for (TIterator<? extends E> srcIter = c.iterator(); srcIter.hasNext();) {
|
for (TIterator<? extends E> srcIter = c.iterator(); srcIter.hasNext();) {
|
||||||
iter.add(srcIter.next());
|
iter.add(srcIter.next());
|
||||||
iter.next();
|
|
||||||
added = true;
|
added = true;
|
||||||
}
|
}
|
||||||
return added;
|
return added;
|
||||||
|
|
|
@ -317,4 +317,11 @@ public class LinkedListTest {
|
||||||
assertEquals("1", list.getFirst());
|
assertEquals("1", list.getFirst());
|
||||||
assertEquals("2", list.getLast());
|
assertEquals("2", list.getLast());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAddAllPositioned() {
|
||||||
|
LinkedList<String> ll = new LinkedList<>(Arrays.asList("a", "b", "c", "d"));
|
||||||
|
ll.addAll(2, new LinkedList<>(ll));
|
||||||
|
assertArrayEquals(new String[] {"a", "b", "a", "b", "c", "d", "c", "d"}, ll.toArray());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user