6436314: Vector could be created with appropriate size in DefaultComboBoxModel
authorvkarnauk
Fri, 31 May 2013 19:34:02 +0400
changeset 17898 f47410f6015c
parent 17897 fb367e67916d
child 17899 d3a864bdee7d
6436314: Vector could be created with appropriate size in DefaultComboBoxModel Reviewed-by: alexsch, alexp
jdk/src/share/classes/javax/swing/DefaultComboBoxModel.java
--- a/jdk/src/share/classes/javax/swing/DefaultComboBoxModel.java	Fri May 31 18:46:41 2013 +0400
+++ b/jdk/src/share/classes/javax/swing/DefaultComboBoxModel.java	Fri May 31 19:34:02 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -55,8 +55,7 @@
      * @param items  an array of Object objects
      */
     public DefaultComboBoxModel(final E items[]) {
-        objects = new Vector<E>();
-        objects.ensureCapacity( items.length );
+        objects = new Vector<E>(items.length);
 
         int i,c;
         for ( i=0,c=items.length;i<c;i++ )