6436314: Vector could be created with appropriate size in DefaultComboBoxModel

Reviewed-by: alexsch, alexp
This commit is contained in:
Vladislav Karnaukhov 2013-05-31 19:34:02 +04:00
parent 9c64c6f45b
commit a754c039be

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -55,8 +55,7 @@ public class DefaultComboBoxModel<E> extends AbstractListModel<E> implements Mut
* @param items an array of Object objects * @param items an array of Object objects
*/ */
public DefaultComboBoxModel(final E items[]) { public DefaultComboBoxModel(final E items[]) {
objects = new Vector<E>(); objects = new Vector<E>(items.length);
objects.ensureCapacity( items.length );
int i,c; int i,c;
for ( i=0,c=items.length;i<c;i++ ) for ( i=0,c=items.length;i<c;i++ )