diff --git a/src/main/java/org/apache/commons/collections/list/SetUniqueList.java b/src/main/java/org/apache/commons/collections/list/SetUniqueList.java index 7006f3803..456fb79fc 100644 --- a/src/main/java/org/apache/commons/collections/list/SetUniqueList.java +++ b/src/main/java/org/apache/commons/collections/list/SetUniqueList.java @@ -192,18 +192,13 @@ public class SetUniqueList extends AbstractSerializableListDecorator { */ @Override public boolean addAll(int index, Collection coll) { - HashSet temp = new HashSet(coll); - temp.removeAll(set); - if (temp.isEmpty()) { - return false; - } + final List temp = new ArrayList(); for (E e : coll) { - if (temp.contains(e)) { - add(index, e); - index++; + if (set.add(e)) { + temp.add(e); } } - return true; + return super.addAll(index, temp); } //-----------------------------------------------------------------------