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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 5.0
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b40
    • CPU:
      generic
    • OS:
      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

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

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: