United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6436314 Vector could be created with appropriate size in DefaultComboBoxModel
JDK-6436314 : Vector could be created with appropriate size in DefaultComboBoxModel

Details
Type:
Bug
Submit Date:
2006-06-08
Status:
Resolved
Updated Date:
2013-12-17
Project Name:
JDK
Resolved Date:
2013-05-31
Component:
client-libs
OS:
generic
Sub-Component:
javax.swing
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
6,7,8
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Backport:

Sub Tasks

Description
src/share/classes/javax/swing/DefaultComboBoxModel.java:51:    public DefaultComboBoxModel(final Object items[]) {
    src/share/classes/javax/swing/DefaultComboBoxModel.java:52:         objects = new Vector();
    src/share/classes/javax/swing/DefaultComboBoxModel.java:53:         objects.ensureCapacity( items.length ); 

creates a default-sized Vector and then resizes it.  That probably drops the default-sized backing array on the floor and allocates a new one.  It would be more efficient to create the Vector with the appropriate size.  I don't know what the average size of the items array is to the DefaultComboBoxModel constructor.  If that array is typically small, then maybe this isn't a problem.

                                    

Comments
EVALUATION

Contribution forum : https://jdk-collaboration.dev.java.net/servlets/ProjectForumMessageView?forumID=1463&messageID=13774
                                     
2006-06-21
URL:   http://hg.openjdk.java.net/jdk8/awt/jdk/rev/791fd2ef87b3
User:  mcherkas
Date:  2013-05-31 15:35:52 +0000

                                     
2013-05-31
URL:   http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/791fd2ef87b3
User:  lana
Date:  2013-06-11 18:41:37 +0000

                                     
2013-06-11



Hardware and Software, Engineered to Work Together