Class KiwiEnums2

java.lang.Object
org.kiwiproject.beta.base.KiwiEnums2

@Beta public final class KiwiEnums2 extends Object
Static utilities for working with Enum.

These may eventually be moved into KiwiEnums in kiwi.

  • Method Details

    • entries

      public static <E extends Enum<E>> List<E> entries(Class<E> enumClass)
      Return the constants in the given enum class as a list.

      Kiwi version 4.12.0 adds methods listOf and streamOf.

      Either of these methods should be preferred to this method, though listOf is a direct replacement.

      This method may be deprecated in a future release (but probably not).

      Type Parameters:
      E - the type in the enum
      Parameters:
      enumClass - the enum class
      Returns:
      an unmodifiable list containing the enum constants
      Throws:
      IllegalArgumentException - if the given class is not an enum