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

(coll) Modify LinkedHashMap and LinkedHashSet to include first() and last()

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 1.4.1
    • core-libs

      eldes

      Name: rmT116609 Date: 04/15/2003


      A DESCRIPTION OF THE REQUEST :
      In working with the LinkedHashMap class a bit recently, I think I've found a few additional convenience methods that could prove useful. The following is a list:

      1. A method to get the first node in the list. After a quick glance at the code, this seems like it would simply involve accessing the 'header' entry.
      2. A method to get the last, or eldest entry in the list. If I'm not mistaken, this seems like it would be the 'header.before' entry.
      3. A method to support reverse iteration. Since it is a doubly-linked list, once again, easy modification.
      4. A method, given a key, to start iteration at that key's point in the list.

      JUSTIFICATION :
      1. Once again, if I'm correct, the only way to get the last (eldest) entry is to traverse the whole list via the iterator.
      2. Reverse iteration would be even more complex.
      3. Starting iteration given a particular key would involve a sequential search in traversing the list.
      (Review ID: 184177)
      ======================================================================

            Unassigned Unassigned
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: