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

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

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P5
    • Resolution: Won't Fix
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_2000

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: