--- jsr166/src/jsr166e/extra/ReadMostlyVector.java 2012/10/12 14:09:35 1.28
+++ jsr166/src/jsr166e/extra/ReadMostlyVector.java 2013/01/14 18:52:56 1.34
@@ -14,7 +14,7 @@ import java.util.*;
* throughput when invocations of read-only methods by multiple
* threads are most common.
*
- *
The iterators returned by this class's {@link #iterator()
+ *
The iterators returned by this class's {@link #iterator()
* iterator} and {@link #listIterator(int) listIterator} methods are
* best-effort in the presence of concurrent modifications, and do
* NOT throw {@link ConcurrentModificationException}. An
@@ -93,7 +93,6 @@ public class ReadMostlyVector
* Creates an empty vector with the given initial capacity.
*
* @param initialCapacity the initial capacity of the underlying array
- *
* @throws IllegalArgumentException if initial capacity is negative
*/
public ReadMostlyVector(int initialCapacity) {
@@ -158,7 +157,7 @@ public class ReadMostlyVector
else
newCapacity = MAX_ARRAY_SIZE;
}
- return array = ((items == null) ?
+ return array = ((items == null) ?
new Object[newCapacity] :
Arrays.copyOf(items, newCapacity));
}
@@ -172,7 +171,7 @@ public class ReadMostlyVector
static int findFirstIndex(Object[] items, Object x, int index, int fence) {
int len;
if (items != null && (len = items.length) > 0) {
- int start = (index < 0)? 0 : index;
+ int start = (index < 0) ? 0 : index;
int bound = (fence < len) ? fence : len;
for (int i = start; i < bound; ++i) {
Object e = items[i];
@@ -406,7 +405,7 @@ public class ReadMostlyVector
sb.append('[');
for (;;) {
Object e = items[i];
- sb.append((e == this)? "(this Collection)" : e.toString());
+ sb.append((e == this) ? "(this Collection)" : e.toString());
if (++i < fence)
sb.append(',').append(' ');
else
@@ -427,7 +426,7 @@ public class ReadMostlyVector
n = len;
int fence = bound < 0 || bound > n ? n : bound;
int i = (origin < 0) ? 0 : origin;
- if (i != fence)
+ if (i != fence)
return Arrays.copyOfRange(items, i, fence, Object[].class);
}
return new Object[0];
@@ -568,7 +567,7 @@ public class ReadMostlyVector
final StampedLock lock = this.lock;
long stamp = lock.tryOptimisticRead();
Object[] items;
- if (index >= 0 && (items = array) != null &&
+ if (index >= 0 && (items = array) != null &&
index < count && index < items.length) {
@SuppressWarnings("unchecked") E e = (E)items[index];
if (lock.validate(stamp))
@@ -584,7 +583,7 @@ public class ReadMostlyVector
long stamp = lock.readLock();
try {
Object[] items;
- if ((items = array) != null && index < items.length &&
+ if ((items = array) != null && index < items.length &&
index < count && index >= 0)
e = (E)items[index];
else
@@ -594,9 +593,9 @@ public class ReadMostlyVector
}
if (oobe)
throw new ArrayIndexOutOfBoundsException(index);
- return (E)e;
+ return e;
}
-
+
public int hashCode() {
int h;
final StampedLock lock = this.lock;
@@ -608,7 +607,7 @@ public class ReadMostlyVector
}
return h;
}
-
+
public int indexOf(Object o) {
int idx;
final StampedLock lock = this.lock;
@@ -743,7 +742,7 @@ public class ReadMostlyVector
if (ret != null)
return ret;
}
-
+
throw new ArrayIndexOutOfBoundsException(fromIndex < 0 ? fromIndex : toIndex);
}
@@ -867,7 +866,7 @@ public class ReadMostlyVector
final StampedLock lock = this.lock;
long stamp = lock.readLock();
try {
- Object[] items;
+ Object[] items;
int len, n;
if ((items = array) != null && (len = items.length) > 0 &&
(n = count) <= len) {
@@ -921,7 +920,7 @@ public class ReadMostlyVector
long stamp = lock.tryOptimisticRead();
Object[] items;
int i;
- if ((items = array) != null && (i = count - 1) >= 0 &&
+ if ((items = array) != null && (i = count - 1) >= 0 &&
i < items.length) {
@SuppressWarnings("unchecked") E e = (E)items[i];
if (lock.validate(stamp))
@@ -974,7 +973,7 @@ public class ReadMostlyVector
try {
if (index < count)
idx = findLastIndex(array, o, index, 0);
- else
+ else
oobe = true;
} finally {
lock.unlockRead(stamp);
@@ -1039,7 +1038,7 @@ public class ReadMostlyVector
long stamp = lock.writeLock();
try {
Object[] items = array;
- int cap = (items == null)? 0 : items.length;
+ int cap = (items == null) ? 0 : items.length;
if (minCapacity - cap > 0)
grow(minCapacity);
} finally {
@@ -1248,7 +1247,7 @@ public class ReadMostlyVector
static final class ReadMostlyVectorSublist
implements List, RandomAccess, java.io.Serializable {
- static final long serialVersionUID = 3041673470172026059L;
+ private static final long serialVersionUID = 3041673470172026059L;
final ReadMostlyVector list;
final int offset;