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

(coll) LinkedHashMap to support ListIterators

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: core-libs

      Description

      A DESCRIPTION OF THE REQUEST :
      Since LHM is ordered you can use LHM.iterator() LHM.values() and LHM.entries() to get items in order. However, you cannot get values in *reverse* order as there is no equivalent of Vector.listIterator(int).

      JUSTIFICATION :
      Performance and usability.

      This is what i expected it to do already !

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      LHM.values() and LHM.entries() to return an AbstractSequentialList rather than a Collection interface (implemented as an anonymous extension of AbstractCollection). **This would not break any existing applications**
      ACTUAL -
      LHM.values() and LHM.entries() return an AbstractCollection that cannot therefore present a ListIterator to the user.

      CUSTOMER SUBMITTED WORKAROUND :
      Currently you have to use :

      Collections.list( Collections.enumeration( linkedhashmap.values() ) );

      The performance of this is appalling considering the underlying collection is a linked list. Obviously, we maintain a second index to get around this.
      ###@###.### 2005-05-06 06:41:27 GMT

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: