garydgregory commented on a change in pull request #730:
URL: https://github.com/apache/commons-lang/pull/730#discussion_r631026959



##########
File path: src/main/java/org/apache/commons/lang3/EnumUtils.java
##########
@@ -294,6 +295,25 @@
         return map;
     }
 
+    /**
+     * <p>Gets the {@code Map} of enums.</p>
+     *
+     * <p>This method is useful when you need a map of enums.</p>
+     *
+     * @param <E> the type of enumeration
+     * @param <K> the type of the map key
+     * @param enumClass the class of the enum to query, not null
+     * @param keyFunction the function to query for the key, not null
+     * @return the modifiable map of enums, never null
+     */

Review comment:
       Hi @MaxwellCody and thank you for your PR. Some comments:
   
   - Add `@since 3.13.0`
   - "Eat own dog food" and reimplement `EnumUtils.getEnumMap(Class<E>)` to use 
this method.

##########
File path: src/main/java/org/apache/commons/lang3/EnumUtils.java
##########
@@ -294,6 +295,25 @@
         return map;
     }
 
+    /**
+     * <p>Gets the {@code Map} of enums.</p>
+     *
+     * <p>This method is useful when you need a map of enums.</p>
+     *
+     * @param <E> the type of enumeration
+     * @param <K> the type of the map key
+     * @param enumClass the class of the enum to query, not null
+     * @param keyFunction the function to query for the key, not null
+     * @return the modifiable map of enums, never null
+     */
+    public static <E extends Enum<E>, K> Map<K, E> getEnumMap(final Class<E> 
enumClass, final Function<E, K> keyFunction) {
+        final Map<K, E> map = new LinkedHashMap<>();

Review comment:
       Add `Objects.requireNonNull(enumClass, "enumClass")` as the 1st line of 
this method.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to