109 |
|
initialCapacity |= (initialCapacity >>> 16); |
110 |
|
initialCapacity++; |
111 |
|
|
112 |
< |
if (initialCapacity < 0) // Too many elements, must back off |
113 |
< |
initialCapacity >>>= 1;// Good luck allocating 2 ^ 30 elements |
112 |
> |
if (initialCapacity < 0) // Too many elements, must back off |
113 |
> |
initialCapacity >>>= 1; // Good luck allocating 2^30 elements |
114 |
|
} |
115 |
|
elements = new Object[initialCapacity]; |
116 |
|
} |
488 |
|
* |
489 |
|
* @return true if elements moved backwards |
490 |
|
*/ |
491 |
< |
private boolean delete(int i) { |
491 |
> |
boolean delete(int i) { |
492 |
|
checkInvariants(); |
493 |
|
final Object[] elements = this.elements; |
494 |
|
final int mask = elements.length - 1; |
883 |
|
private int fence; // -1 until first use |
884 |
|
private int index; // current index, modified on traverse/split |
885 |
|
|
886 |
< |
/** Creates new spliterator covering the given array and range */ |
886 |
> |
/** Creates new spliterator covering the given array and range. */ |
887 |
|
DeqSpliterator(ArrayDeque<E> deq, int origin, int fence) { |
888 |
|
this.deq = deq; |
889 |
|
this.index = origin; |
899 |
|
return t; |
900 |
|
} |
901 |
|
|
902 |
< |
public Spliterator<E> trySplit() { |
902 |
> |
public DeqSpliterator<E> trySplit() { |
903 |
|
int t = getFence(), h = index, n = deq.elements.length; |
904 |
|
if (h != t && ((h + 1) & (n - 1)) != t) { |
905 |
|
if (h > t) |
906 |
|
t += n; |
907 |
|
int m = ((h + t) >>> 1) & (n - 1); |
908 |
< |
return new DeqSpliterator<>(deq, h, index = m); |
908 |
> |
return new DeqSpliterator<E>(deq, h, index = m); |
909 |
|
} |
910 |
|
return null; |
911 |
|
} |