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

RFE: DefaultListModel should have an addAll(Collection c)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.0
    • client-libs



      Name: rmT116609 Date: 12/05/2001


      java version "1.3.1_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
      Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)

      There is currently no straight forward way of adding a Collection to a DefaultListModel. By checking the
      DefaultListModel.java src I found that declaration for addAll() is already there but is commented out.
      Since DefaultListModel is backed by a Vector and Vector has addAll() since it is a java.util.List, so
       implementing addAll() would be pretty simple in DefaultListModel. Maybe:
      ---
      int index0 = getSize();
      delegate.addAll(c);
      int index1 = getSize()
      fireIntervalAdded(this, index0, index1);
      ---
      On the longer term DefaultListModel should implement the List interface. Also,
      you should consider adding a DefaultSetModel backed by an (optionally sorted)
      Set.

      If you are going to implement this please try to give an estimate when (or which version).

      I've checked the java doc for 1.4beta3 but DefaultListModel were not improve there.
      (Review ID: 136795)
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: