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

Suggestion for client data for entries in List class

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.0
    • client-libs
    • sparc
    • generic

      I know the interfaces are supposed to be frozen, but ...

      It would be good if arbitrary objects could be associated with the
      entries in a List class.

      In the old days, this would be done by having client data entries
      associated with each list entry, and all the reasons that clientData
      has been provided in the past are appropriate justification for the
      suggestion enhancement here.

      In these more enlightened OO days, an interesting and easy to implement
      alternative to client data would be to store java.lang.Objects on the
      List, and judicially use toString() at the necessary times when a
      String is actually required. This would require a simple and upward
      compatible change for the addEntry replaceEntry methods. For backward
      compatability, getItem could still return a String, but there could be
      a new method to get the item as a raw Object.

      Such an approach fits in easily with the current implementation, which
      already uses a Vector (of java.lang.Objects) to store the String
      objects.

      -- Jon

            msomlosunw Mike Somlo (Inactive)
            jjg Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: