-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
1.4.0
-
x86
-
windows_2000
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)
======================================================================
- duplicates
-
JDK-4842658 DefaultListModel and DefaultComboBoxModel should support addAll (Collection c)
-
- Resolved
-