diff --git a/src/main/java/org/apache/commons/collections4/ListUtils.java b/src/main/java/org/apache/commons/collections4/ListUtils.java index 6a8197a0a6..fd50c05267 100644 --- a/src/main/java/org/apache/commons/collections4/ListUtils.java +++ b/src/main/java/org/apache/commons/collections4/ListUtils.java @@ -186,11 +186,10 @@ public static List fixedSizeList(final List 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 List findDuplicates(final List 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 seen = new HashSet<>(); Set duplicates = new HashSet<>();