diff --git a/classlib/src/main/java/org/teavm/classlib/java/util/TAbstractSequentialList.java b/classlib/src/main/java/org/teavm/classlib/java/util/TAbstractSequentialList.java index 8483efbe5..77250f636 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/util/TAbstractSequentialList.java +++ b/classlib/src/main/java/org/teavm/classlib/java/util/TAbstractSequentialList.java @@ -72,7 +72,6 @@ public abstract class TAbstractSequentialList extends TAbstractList { boolean added = false; for (TIterator srcIter = c.iterator(); srcIter.hasNext();) { iter.add(srcIter.next()); - iter.next(); added = true; } return added; diff --git a/tests/src/test/java/org/teavm/classlib/java/util/LinkedListTest.java b/tests/src/test/java/org/teavm/classlib/java/util/LinkedListTest.java index 83dbbbf3f..ec1a07aa0 100644 --- a/tests/src/test/java/org/teavm/classlib/java/util/LinkedListTest.java +++ b/tests/src/test/java/org/teavm/classlib/java/util/LinkedListTest.java @@ -317,4 +317,11 @@ public class LinkedListTest { assertEquals("1", list.getFirst()); assertEquals("2", list.getLast()); } + + @Test + public void testAddAllPositioned() { + LinkedList 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()); + } }