ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/Vector.java
(Generate patch)

Comparing jsr166/src/main/java/util/Vector.java (file contents):
Revision 1.4 by jsr166, Mon Nov 28 03:28:25 2005 UTC vs.
Revision 1.6 by jsr166, Tue Nov 29 06:19:39 2005 UTC

# Line 147 | Line 147 | public class Vector<E>
147       * @since   1.2
148       */
149      public Vector(Collection<? extends E> c) {
150 <        Object[] a = c.toArray();
151 <        elementCount = a.length;
152 <        // If c.toArray incorrectly doesn't return Object[], copy it.
153 <        if (a.getClass() == Object[].class)
154 <            elementData = a;
155 <        else
156 <            elementData = Arrays.copyOf(a, a.length, Object[].class);
150 >        elementData = c.toArray();
151 >        elementCount = elementData.length;
152 >        // c.toArray might (incorrectly) not return Object[] (see 6260652)
153 >        if (elementData.getClass() != Object[].class)
154 >            elementData = Arrays.copyOf(elementData, elementCount, Object[].class);
155      }
156  
157      /**
# Line 1088 | Line 1086 | public class Vector<E>
1086          public boolean hasNext() {
1087              // Racy but within spec, since modifications are checked
1088              // within or after synchronization in next/previous
1089 <            return cursor < Vector.this.elementCount;
1089 >            return cursor != elementCount;
1090          }
1091  
1092          public boolean hasPrevious() {
1093 <            return cursor > 0;
1093 >            return cursor != 0;
1094          }
1095  
1096          public int nextIndex() {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines