diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-22 14:48:04 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-22 14:48:04 -0400 |
| commit | 42f7d379a430aaf2fad169f0170de04072b08b10 (patch) | |
| tree | 5d46b43b2d9272f4e593820ee147b3ae3f0d82b0 /BJC-Utils2/src/main/java/bjc/utils/funcutils/EnumUtils.java | |
| parent | b65b705c391bb772bc41269bce5243c1cc88969d (diff) | |
Formatting changes
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcutils/EnumUtils.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/funcutils/EnumUtils.java | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/EnumUtils.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/EnumUtils.java index 3374aa2..67fd5ec 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/EnumUtils.java +++ b/BJC-Utils2/src/main/java/bjc/utils/funcutils/EnumUtils.java @@ -14,24 +14,6 @@ import bjc.utils.funcdata.IFunctionalList; */ public class EnumUtils { /** - * Get a random value from an enum - * - * @param <E> - * The type of the enum - * @param enumClass - * The class of the enum - * @param rnd - * The random source to use - * @return A random value from the specified enum - */ - public static <E extends Enum<E>> E getRandomValue(Class<E> enumClass, - Random rnd) { - E[] enumValues = enumClass.getEnumConstants(); - - return new FunctionalList<>(enumValues).randItem(rnd::nextInt); - } - - /** * Do an action for a random number of enum values * * @param <E> @@ -61,4 +43,22 @@ public class EnumUtils { valueList.forEach(action); } + + /** + * Get a random value from an enum + * + * @param <E> + * The type of the enum + * @param enumClass + * The class of the enum + * @param rnd + * The random source to use + * @return A random value from the specified enum + */ + public static <E extends Enum<E>> E getRandomValue(Class<E> enumClass, + Random rnd) { + E[] enumValues = enumClass.getEnumConstants(); + + return new FunctionalList<>(enumValues).randItem(rnd::nextInt); + } } |
