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

(coll) LinkedHashMap to support ListIterators

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • core-libs

      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

            smarks Stuart Marks
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: