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

Add get() to Set interface

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • P4
    • tbd
    • 8-pool
    • core-libs
    • None

    Description

      The Set interface does not have a get() method. This method is useful for interning. The current workaround is to use a Map and each entry has the key and value as the same object. This wastes memory for the reference in each entry.

      The tricky question is what should the default implementation do. Should it throw UnsupportedOperationException? Maybe we don't want to add the get() method to the Set interface. Maybe we want to add the get() method to HashSet and perhaps the other classes which implement the Set interface.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              nreynold Nathan Reynolds
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: