diff --git a/src/main/java/org/apache/commons/collections4/ListUtils.java b/src/main/java/org/apache/commons/collections4/ListUtils.java index b3dd237060..ff19fc8876 100644 --- a/src/main/java/org/apache/commons/collections4/ListUtils.java +++ b/src/main/java/org/apache/commons/collections4/ListUtils.java @@ -24,7 +24,6 @@ import java.util.Iterator; import java.util.List; import java.util.Objects; -import java.util.Set; import org.apache.commons.collections4.bag.HashBag; import org.apache.commons.collections4.functors.DefaultEquator; @@ -189,19 +188,7 @@ public static List fixedSizeList(final List list) { * @since 4.5.0-M3 */ public static List findDuplicates(final List list) { - Objects.requireNonNull(list, "The input list must not be null."); - - Set seen = new HashSet<>(); - Set duplicates = new HashSet<>(); - List result = new ArrayList<>(); - - for (E element : list) { - if (!seen.add(element) && duplicates.add(element)) { - result.add(element); - } - } - - return result; + return CollectionUtils.duplicateList(list); } /**