JDK-4304287 : Swing components should require the use of Collections and not Vectors
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0,1.2.2,1.3.0,1.4.0,5.0,6
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS:
    generic,linux,windows_95,windows_98,windows_2000,windows_xp generic,linux,windows_95,windows_98,windows_2000,windows_xp
  • CPU: generic,x86
  • Submitted: 2000-01-12
  • Updated: 2017-05-23
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
Name: krT82822			Date: 01/12/2000


java version "1.3beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3beta-O)
Java(TM) HotSpot Client VM (build 1.3beta-O-release, 1.3beta-O-release, interpr)

Let's say I have an ArrayList (or any other Collection) and I want to create a
JBomboBox from it, I'd either have to turn it into a Vector or an array of
Objects.  Vectors have too much bloat because they maintain backwards
compatibility (which is the reason I use ArrayList) so this inherently limits
Swing components.  The optimal solution is instead of using constructors such as

JComboBox(Vector v)

use

JComboBox(Collection C)

At least then developers have a choice.
(Review ID: 99866) 
======================================================================

Comments
EVALUATION See also 6454581, which is about using HashMap instead of Hashtable in private implementation. See also 6454582, which is about using ArrayList instead of Vector in private implementation. See also 6455353, which is about using ArrayDeque instad of Stack in private implementation.
01-08-2006

EVALUATION Contribution-Forum:https://jdk-collaboration.dev.java.net/servlets/ProjectForumMessageView?messageID=11418&forumID=1463
13-02-2006

EVALUATION I've closed a number of bugs out against this. In the places where we expose or take Vectors/Arrays we need to investigate taking the appropriate Collection class. We obviously can't remove the use of Vector and what not, but in a handful of places it may make sense to take the corresponding Collection class (list JList, JTree, JTable constructors). scott.violet@eng 2001-07-10 Another place that we have been requested to allow lists is in the JOptionPane methods to show dialogs with a list of messages. I am closing that bug as a duplicate of this one. ###@###.### 2001-11-27
27-11-2001