Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 3.0
    • Component/s: lang.*
    • Labels:
      None

      Description

      Below is an EnumUtils for JDK 1.5. It's also found in the enums.EnumUtils javadoc:

      import java.util.*;

      public class EnumUtils {

      public static Enum getEnum(Class enumClass, String token)

      { return Enum.valueOf(enumClass, token); }

      public static Map getEnumMap(Class enumClass) {
      HashMap map = new HashMap();
      Iterator itr = EnumUtils.iterator(enumClass);
      while(itr.hasNext())

      { Enum enm = (Enum) itr.next(); map.put( enm.name(), enm ); }

      return map;
      }

      public static List getEnumList(Class enumClass)

      { return new ArrayList( EnumSet.allOf(enumClass) ); }

      public static Iterator iterator(Class enumClass)

      { return EnumUtils.getEnumList(enumClass).iterator(); }

      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              bayard Henri Yandell
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: