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

Enum.valueOf(String) should used hash table instead of linear search

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 5.0
    • 1.4.0
    • core-libs
    • b40
    • generic
    • generic

    Description

      The current implementation of Enum.valueOf(String) is unnecessarily slow, and could easily be sped up from O(n) to O(k). There is a small space penalty (one little HashMap per enum type) but it's worth it.

      Attachments

        Activity

          People

            jjb Josh Bloch
            jjb Josh Bloch
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: