Skip to content

Commit

Permalink
findDuplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
hemanth0525 committed Sep 1, 2024
1 parent 91e76c8 commit e12fc22
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/org/apache/commons/collections4/ListUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,10 @@ public static <E> List<E> fixedSizeList(final List<E> list) {
* @param list the list to check for duplicates, must not be null
* @return a list of duplicate elements, or an empty list if no duplicates are found
* @throws NullPointerException if the list is null
* @since 4.5.0-M3
*/
public static <E> List<E> findDuplicates(final List<E> list) {
if (list == null) {
throw new NullPointerException("The input list must not be null.");
}
Objects.requireNonNull(list, "The input list must not be null.");

Set<E> seen = new HashSet<>();
Set<E> duplicates = new HashSet<>();
Expand Down

0 comments on commit e12fc22

Please sign in to comment.