14 |
|
* throughput when invocations of read-only methods by multiple |
15 |
|
* threads are most common. |
16 |
|
* |
17 |
< |
* <p> The iterators returned by this class's {@link #iterator() |
17 |
> |
* <p>The iterators returned by this class's {@link #iterator() |
18 |
|
* iterator} and {@link #listIterator(int) listIterator} methods are |
19 |
|
* best-effort in the presence of concurrent modifications, and do |
20 |
|
* <em>NOT</em> throw {@link ConcurrentModificationException}. An |
93 |
|
* Creates an empty vector with the given initial capacity. |
94 |
|
* |
95 |
|
* @param initialCapacity the initial capacity of the underlying array |
96 |
– |
* |
96 |
|
* @throws IllegalArgumentException if initial capacity is negative |
97 |
|
*/ |
98 |
|
public ReadMostlyVector(int initialCapacity) { |
171 |
|
static int findFirstIndex(Object[] items, Object x, int index, int fence) { |
172 |
|
int len; |
173 |
|
if (items != null && (len = items.length) > 0) { |
174 |
< |
int start = (index < 0)? 0 : index; |
174 |
> |
int start = (index < 0) ? 0 : index; |
175 |
|
int bound = (fence < len) ? fence : len; |
176 |
|
for (int i = start; i < bound; ++i) { |
177 |
|
Object e = items[i]; |
405 |
|
sb.append('['); |
406 |
|
for (;;) { |
407 |
|
Object e = items[i]; |
408 |
< |
sb.append((e == this)? "(this Collection)" : e.toString()); |
408 |
> |
sb.append((e == this) ? "(this Collection)" : e.toString()); |
409 |
|
if (++i < fence) |
410 |
|
sb.append(',').append(' '); |
411 |
|
else |
1038 |
|
long stamp = lock.writeLock(); |
1039 |
|
try { |
1040 |
|
Object[] items = array; |
1041 |
< |
int cap = (items == null)? 0 : items.length; |
1041 |
> |
int cap = (items == null) ? 0 : items.length; |
1042 |
|
if (minCapacity - cap > 0) |
1043 |
|
grow(minCapacity); |
1044 |
|
} finally { |