ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166e/extra/ReadMostlyVector.java
(Generate patch)

Comparing jsr166/src/jsr166e/extra/ReadMostlyVector.java (file contents):
Revision 1.29 by jsr166, Fri Oct 12 16:23:28 2012 UTC vs.
Revision 1.35 by jsr166, Sun Jan 18 20:17:33 2015 UTC

# Line 5 | Line 5
5   */
6  
7   package jsr166e.extra;
8 +
9   import jsr166e.StampedLock;
10   import java.util.*;
11  
# Line 14 | Line 15 | import java.util.*;
15   * throughput when invocations of read-only methods by multiple
16   * threads are most common.
17   *
18 < * <p> The iterators returned by this class's {@link #iterator()
18 > * <p>The iterators returned by this class's {@link #iterator()
19   * iterator} and {@link #listIterator(int) listIterator} methods are
20   * best-effort in the presence of concurrent modifications, and do
21   * <em>NOT</em> throw {@link ConcurrentModificationException}.  An
# Line 93 | Line 94 | public class ReadMostlyVector<E>
94       * Creates an empty vector with the given initial capacity.
95       *
96       * @param initialCapacity the initial capacity of the underlying array
96     *
97       * @throws IllegalArgumentException if initial capacity is negative
98       */
99      public ReadMostlyVector(int initialCapacity) {
# Line 172 | Line 172 | public class ReadMostlyVector<E>
172      static int findFirstIndex(Object[] items, Object x, int index, int fence) {
173          int len;
174          if (items != null && (len = items.length) > 0) {
175 <            int start = (index < 0)? 0 : index;
175 >            int start = (index < 0) ? 0 : index;
176              int bound = (fence < len) ? fence : len;
177              for (int i = start; i < bound; ++i) {
178                  Object e = items[i];
# Line 406 | Line 406 | public class ReadMostlyVector<E>
406                  sb.append('[');
407                  for (;;) {
408                      Object e = items[i];
409 <                    sb.append((e == this)? "(this Collection)" : e.toString());
409 >                    sb.append((e == this) ? "(this Collection)" : e.toString());
410                      if (++i < fence)
411                          sb.append(',').append(' ');
412                      else
# Line 594 | Line 594 | public class ReadMostlyVector<E>
594          }
595          if (oobe)
596              throw new ArrayIndexOutOfBoundsException(index);
597 <        return (E)e;
597 >        return e;
598      }
599  
600      public int hashCode() {
# Line 1039 | Line 1039 | public class ReadMostlyVector<E>
1039              long stamp = lock.writeLock();
1040              try {
1041                  Object[] items = array;
1042 <                int cap = (items == null)? 0 : items.length;
1042 >                int cap = (items == null) ? 0 : items.length;
1043                  if (minCapacity - cap > 0)
1044                      grow(minCapacity);
1045              } finally {
# Line 1248 | Line 1248 | public class ReadMostlyVector<E>
1248  
1249      static final class ReadMostlyVectorSublist<E>
1250              implements List<E>, RandomAccess, java.io.Serializable {
1251 <        static final long serialVersionUID = 3041673470172026059L;
1251 >        private static final long serialVersionUID = 3041673470172026059L;
1252  
1253          final ReadMostlyVector<E> list;
1254          final int offset;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines