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

Add get() to Set interface

XMLWordPrintable

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

      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.

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

              Created:
              Updated: