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 |
|
} |