JDK-4842658 : DefaultListModel and DefaultComboBoxModel should support addAll (Collection c)
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.1
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2003-04-04
  • Updated: 2018-05-11
  • Resolved: 2018-05-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11
11 b13Fixed
Related Reports
CSR :  
Duplicate :  
Description

Name: jk109818			Date: 04/03/2003


FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)

A DESCRIPTION OF THE PROBLEM :
The default list models (DefaultListModel and
DefaultComboBoxModel) in Swing do not provide a function for
multiple element insertion.  Specifically, they do not
support the bulk adding of all of the elements in a
Collection.  Adding the elements of a Collection
individually requires more code and, since each addition to
a model causes an event notification, is slower.

REPRODUCIBILITY :
This bug can be reproduced always.
(Review ID: 181289) 
======================================================================

Comments
Same request from another enhancement - JDK-4549174
25-01-2018

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) ======================================================================
25-01-2018