Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6548438

(enum) java.lang.Enum should have a values(Class<T>) method.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P5 P5
    • None
    • 6
    • core-libs
    • x86
    • windows_2000

      A DESCRIPTION OF THE REQUEST :
      java.lang.Enum should have a static method values(Class<T>).
      The signature of the method would be that:

      public static <T extends Enum<T>> T[] values(Class<T> enumType);

      JUSTIFICATION :
      Every enum class has a static method valueOf(String) which the compiler generates in subclasses. The java.lang.Enum has the static method valueOf(Class<T>, String) which is a "companion" of the valueOf(String). The method valueOf(Class<T>, String) is very helpful in enum-based data structures.

      However, the values() method doesn't have a "companion" in java.lang.Enum. This makes a defficiency when working in enum-based data structures which the method values(Class<T>) could easily supply.

            darcy Joe Darcy
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: