3131import org .apache .commons .lang3 .stream .Streams ;
3232
3333/**
34- * Utility library to provide helper methods for Java enums.
34+ * Provides methods for Java enums.
3535 *
3636 * <p>#ThreadSafe#</p>
3737 *
@@ -46,11 +46,12 @@ public class EnumUtils {
4646
4747 /**
4848 * Validate {@code enumClass}.
49- * @param <E> the type of the enumeration
50- * @param enumClass to check
51- * @return {@code enumClass}
52- * @throws NullPointerException if {@code enumClass} is {@code null}
53- * @throws IllegalArgumentException if {@code enumClass} is not an enum class
49+ *
50+ * @param <E> the type of the enumeration.
51+ * @param enumClass to check.
52+ * @return {@code enumClass}.
53+ * @throws NullPointerException if {@code enumClass} is {@code null}.
54+ * @throws IllegalArgumentException if {@code enumClass} is not an enum class.
5455 * @since 3.2
5556 */
5657 private static <E extends Enum <E >> Class <E > asEnum (final Class <E > enumClass ) {
@@ -61,11 +62,12 @@ private static <E extends Enum<E>> Class<E> asEnum(final Class<E> enumClass) {
6162
6263 /**
6364 * Validate that {@code enumClass} is compatible with representation in a {@code long}.
64- * @param <E> the type of the enumeration
65- * @param enumClass to check
66- * @return {@code enumClass}
67- * @throws NullPointerException if {@code enumClass} is {@code null}
68- * @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values
65+ *
66+ * @param <E> the type of the enumeration.
67+ * @param enumClass to check.
68+ * @return {@code enumClass}.
69+ * @throws NullPointerException if {@code enumClass} is {@code null}.
70+ * @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values.
6971 * @since 3.0.1
7072 */
7173 private static <E extends Enum <E >> Class <E > checkBitVectorable (final Class <E > enumClass ) {
@@ -83,12 +85,12 @@ private static <E extends Enum<E>> Class<E> checkBitVectorable(final Class<E> en
8385 * <p>Do not use this method if you have more than 64 values in your Enum, as this
8486 * would create a value greater than a long can hold.</p>
8587 *
86- * @param enumClass the class of the enum we are working with, not {@code null}
87- * @param values the values we want to convert, not {@code null}
88- * @param <E> the type of the enumeration
88+ * @param enumClass the class of the enum we are working with, not {@code null}.
89+ * @param values the values we want to convert, not {@code null}.
90+ * @param <E> the type of the enumeration.
8991 * @return a long whose value provides a binary representation of the given set of enum values.
90- * @throws NullPointerException if {@code enumClass} or {@code values} is {@code null}
91- * @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values
92+ * @throws NullPointerException if {@code enumClass} or {@code values} is {@code null}.
93+ * @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values.
9294 * @since 3.0.1
9395 * @see #generateBitVectors(Class, Iterable)
9496 */
@@ -106,13 +108,13 @@ public static <E extends Enum<E>> long generateBitVector(final Class<E> enumClas
106108 * <p>Do not use this method if you have more than 64 values in your Enum, as this
107109 * would create a value greater than a long can hold.</p>
108110 *
109- * @param enumClass the class of the enum we are working with, not {@code null}
110- * @param values the values we want to convert, not {@code null}, neither containing {@code null}
111- * @param <E> the type of the enumeration
111+ * @param enumClass the class of the enum we are working with, not {@code null}.
112+ * @param values the values we want to convert, not {@code null}, neither containing {@code null}.
113+ * @param <E> the type of the enumeration.
112114 * @return a long whose value provides a binary representation of the given set of enum values.
113- * @throws NullPointerException if {@code enumClass} or {@code values} is {@code null}
115+ * @throws NullPointerException if {@code enumClass} or {@code values} is {@code null}.
114116 * @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values,
115- * or if any {@code values} {@code null}
117+ * or if any {@code values} {@code null}.
116118 * @since 3.0.1
117119 * @see #generateBitVectors(Class, Iterable)
118120 */
@@ -134,13 +136,13 @@ public static <E extends Enum<E>> long generateBitVector(final Class<E> enumClas
134136 *
135137 * <p>Use this method if you have more than 64 values in your Enum.</p>
136138 *
137- * @param enumClass the class of the enum we are working with, not {@code null}
138- * @param values the values we want to convert, not {@code null}, neither containing {@code null}
139- * @param <E> the type of the enumeration
139+ * @param enumClass the class of the enum we are working with, not {@code null}.
140+ * @param values the values we want to convert, not {@code null}, neither containing {@code null}.
141+ * @param <E> the type of the enumeration.
140142 * @return a long[] whose values provide a binary representation of the given set of enum values
141143 * with the least significant digits rightmost.
142- * @throws NullPointerException if {@code enumClass} or {@code values} is {@code null}
143- * @throws IllegalArgumentException if {@code enumClass} is not an enum class, or if any {@code values} {@code null}
144+ * @throws NullPointerException if {@code enumClass} or {@code values} is {@code null}.
145+ * @throws IllegalArgumentException if {@code enumClass} is not an enum class, or if any {@code values} {@code null}.
144146 * @since 3.2
145147 */
146148 @ SafeVarargs
@@ -164,13 +166,13 @@ public static <E extends Enum<E>> long[] generateBitVectors(final Class<E> enumC
164166 *
165167 * <p>Use this method if you have more than 64 values in your Enum.</p>
166168 *
167- * @param enumClass the class of the enum we are working with, not {@code null}
168- * @param values the values we want to convert, not {@code null}, neither containing {@code null}
169- * @param <E> the type of the enumeration
169+ * @param enumClass the class of the enum we are working with, not {@code null}.
170+ * @param values the values we want to convert, not {@code null}, neither containing {@code null}.
171+ * @param <E> the type of the enumeration.
170172 * @return a long[] whose values provide a binary representation of the given set of enum values
171173 * with the least significant digits rightmost.
172- * @throws NullPointerException if {@code enumClass} or {@code values} is {@code null}
173- * @throws IllegalArgumentException if {@code enumClass} is not an enum class, or if any {@code values} {@code null}
174+ * @throws NullPointerException if {@code enumClass} or {@code values} is {@code null}.
175+ * @throws IllegalArgumentException if {@code enumClass} is not an enum class, or if any {@code values} {@code null}.
174176 * @since 3.2
175177 */
176178 public static <E extends Enum <E >> long [] generateBitVectors (final Class <E > enumClass , final Iterable <? extends E > values ) {
@@ -264,9 +266,9 @@ public static <E extends Enum<E>> E getEnumIgnoreCase(final Class<E> enumClass,
264266 *
265267 * <p>This method is useful when you need a list of enums rather than an array.</p>
266268 *
267- * @param <E> the type of the enumeration
268- * @param enumClass the class of the enum to query, not null
269- * @return the modifiable list of enums, never null
269+ * @param <E> the type of the enumeration.
270+ * @param enumClass the class of the enum to query, not null.
271+ * @return the modifiable list of enums, never null.
270272 */
271273 public static <E extends Enum <E >> List <E > getEnumList (final Class <E > enumClass ) {
272274 return new ArrayList <>(Arrays .asList (enumClass .getEnumConstants ()));
@@ -277,9 +279,9 @@ public static <E extends Enum<E>> List<E> getEnumList(final Class<E> enumClass)
277279 *
278280 * <p>This method is useful when you need a map of enums by name.</p>
279281 *
280- * @param <E> the type of the enumeration
281- * @param enumClass the class of the enum to query, not null
282- * @return the modifiable map of enum names to enums, never null
282+ * @param <E> the type of the enumeration.
283+ * @param enumClass the class of the enum to query, not null.
284+ * @return the modifiable map of enum names to enums, never null.
283285 */
284286 public static <E extends Enum <E >> Map <String , E > getEnumMap (final Class <E > enumClass ) {
285287 return getEnumMap (enumClass , E ::name );
@@ -292,11 +294,11 @@ public static <E extends Enum<E>> Map<String, E> getEnumMap(final Class<E> enumC
292294 * This method is useful when you need a map of enums by name.
293295 * </p>
294296 *
295- * @param <E> the type of enumeration
296- * @param <K> the type of the map key
297- * @param enumClass the class of the enum to query, not null
298- * @param keyFunction the function to query for the key, not null
299- * @return the modifiable map of enums, never null
297+ * @param <E> the type of enumeration.
298+ * @param <K> the type of the map key.
299+ * @param enumClass the class of the enum to query, not null.
300+ * @param keyFunction the function to query for the key, not null.
301+ * @return the modifiable map of enums, never null.
300302 * @since 3.13.0
301303 */
302304 public static <E extends Enum <E >, K > Map <K , E > getEnumMap (final Class <E > enumClass , final Function <E , K > keyFunction ) {
@@ -412,12 +414,13 @@ public static <E extends Enum<E>> boolean isValidEnumIgnoreCase(final Class<E> e
412414 * enum values that it represents.
413415 *
414416 * <p>If you store this value, beware any changes to the enum that would affect ordinal values.</p>
415- * @param enumClass the class of the enum we are working with, not {@code null}
416- * @param value the long value representation of a set of enum values
417- * @param <E> the type of the enumeration
418- * @return a set of enum values
419- * @throws NullPointerException if {@code enumClass} is {@code null}
420- * @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values
417+ *
418+ * @param enumClass the class of the enum we are working with, not {@code null}.
419+ * @param value the long value representation of a set of enum values.
420+ * @param <E> the type of the enumeration.
421+ * @return a set of enum values.
422+ * @throws NullPointerException if {@code enumClass} is {@code null}.
423+ * @throws IllegalArgumentException if {@code enumClass} is not an enum class or has more than 64 values.
421424 * @since 3.0.1
422425 */
423426 public static <E extends Enum <E >> EnumSet <E > processBitVector (final Class <E > enumClass , final long value ) {
@@ -429,12 +432,13 @@ public static <E extends Enum<E>> EnumSet<E> processBitVector(final Class<E> enu
429432 * enum values that it represents.
430433 *
431434 * <p>If you store this value, beware any changes to the enum that would affect ordinal values.</p>
432- * @param enumClass the class of the enum we are working with, not {@code null}
433- * @param values the long[] bearing the representation of a set of enum values, the least significant digits rightmost, not {@code null}
434- * @param <E> the type of the enumeration
435- * @return a set of enum values
436- * @throws NullPointerException if {@code enumClass} is {@code null}
437- * @throws IllegalArgumentException if {@code enumClass} is not an enum class
435+ *
436+ * @param enumClass the class of the enum we are working with, not {@code null}.
437+ * @param values the long[] bearing the representation of a set of enum values, the least significant digits rightmost, not {@code null}.
438+ * @param <E> the type of the enumeration.
439+ * @return a set of enum values.
440+ * @throws NullPointerException if {@code enumClass} is {@code null}.
441+ * @throws IllegalArgumentException if {@code enumClass} is not an enum class.
438442 * @since 3.2
439443 */
440444 public static <E extends Enum <E >> EnumSet <E > processBitVectors (final Class <E > enumClass , final long ... values ) {
0 commit comments