235 |
|
* @return index 0 <= i < modulus |
236 |
|
*/ |
237 |
|
static final int add(int i, int distance, int modulus) { |
238 |
< |
if ((i += distance) - modulus >= 0) distance -= modulus; |
238 |
> |
if ((i += distance) - modulus >= 0) i -= modulus; |
239 |
|
return i; |
240 |
|
} |
241 |
|
|
820 |
|
|
821 |
|
/** Constructs spliterator over the given range. */ |
822 |
|
DeqSpliterator(int origin, int fence) { |
823 |
+ |
// assert 0 <= origin && origin < elements.length; |
824 |
+ |
// assert 0 <= fence && fence < elements.length; |
825 |
|
this.cursor = origin; |
826 |
|
this.fence = fence; |
827 |
|
} |
1244 |
|
// head == tail disambiguates to "empty". |
1245 |
|
try { |
1246 |
|
int capacity = elements.length; |
1247 |
< |
// assert head >= 0 && head < capacity; |
1248 |
< |
// assert tail >= 0 && tail < capacity; |
1247 |
> |
// assert 0 <= head && head < capacity; |
1248 |
> |
// assert 0 <= tail && tail < capacity; |
1249 |
|
// assert capacity > 0; |
1250 |
|
// assert size() < capacity; |
1251 |
|
// assert head == tail || elements[head] != null; |