243 |
|
* but does catch ones that corrupt traversal. It's a little |
244 |
|
* surprising that javac allows this abuse of generics. |
245 |
|
*/ |
246 |
< |
static final <E> E nonNullElementAt(Object[] elements, int i) { |
247 |
< |
@SuppressWarnings("unchecked") E e = (E) elements[i]; |
246 |
> |
static final <E> E nonNullElementAt(Object[] es, int i) { |
247 |
> |
@SuppressWarnings("unchecked") E e = (E) es[i]; |
248 |
|
if (e == null) |
249 |
|
throw new ConcurrentModificationException(); |
250 |
|
return e; |
1035 |
|
/** |
1036 |
|
* Nulls out count elements, starting at array index from. |
1037 |
|
*/ |
1038 |
< |
private static void clearSlice(Object[] elements, int from, int count) { |
1039 |
< |
final int capacity = elements.length, end = from + count; |
1038 |
> |
private static void clearSlice(Object[] es, int from, int count) { |
1039 |
> |
final int capacity = es.length, end = from + count; |
1040 |
|
final int leg = (capacity - end >= 0) ? end : capacity; |
1041 |
< |
Arrays.fill(elements, from, leg, null); |
1041 |
> |
Arrays.fill(es, from, leg, null); |
1042 |
|
if (leg != end) |
1043 |
< |
Arrays.fill(elements, 0, end - capacity, null); |
1043 |
> |
Arrays.fill(es, 0, end - capacity, null); |
1044 |
|
} |
1045 |
|
|
1046 |
|
/** |