src/java.naming/share/classes/javax/naming/directory/BasicAttributes.java
changeset 48587 f2e87b6383af
parent 47216 71c04702a3d5
equal deleted inserted replaced
48586:8877e857fdd7 48587:f2e87b6383af
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   300     private void readObject(java.io.ObjectInputStream s)
   300     private void readObject(java.io.ObjectInputStream s)
   301             throws java.io.IOException, ClassNotFoundException {
   301             throws java.io.IOException, ClassNotFoundException {
   302         s.defaultReadObject();  // read in the ignoreCase flag
   302         s.defaultReadObject();  // read in the ignoreCase flag
   303         int n = s.readInt();    // number of attributes
   303         int n = s.readInt();    // number of attributes
   304         attrs = (n >= 1)
   304         attrs = (n >= 1)
   305             ? new Hashtable<String,Attribute>(n * 2)
   305                 ? new Hashtable<>(1 + (int) (Math.min(768, n) / .75f))
   306             : new Hashtable<String,Attribute>(2); // can't have initial size of 0 (grrr...)
   306                 : new Hashtable<>(2); // can't have initial size of 0 (grrr...)
   307         while (--n >= 0) {
   307         while (--n >= 0) {
   308             put((Attribute)s.readObject());
   308             put((Attribute)s.readObject());
   309         }
   309         }
   310     }
   310     }
   311 
   311