251 |
|
@SuppressWarnings("unchecked") |
252 |
|
E result = (E) elements[h]; |
253 |
|
// Element is null if deque empty |
254 |
< |
if (result == null) |
255 |
< |
return null; |
256 |
< |
elements[h] = null; // Must null out slot |
257 |
< |
head = (h + 1) & (elements.length - 1); |
254 |
> |
if (result != null) { |
255 |
> |
elements[h] = null; // Must null out slot |
256 |
> |
head = (h + 1) & (elements.length - 1); |
257 |
> |
} |
258 |
|
return result; |
259 |
|
} |
260 |
|
|
262 |
|
int t = (tail - 1) & (elements.length - 1); |
263 |
|
@SuppressWarnings("unchecked") |
264 |
|
E result = (E) elements[t]; |
265 |
< |
if (result == null) |
266 |
< |
return null; |
267 |
< |
elements[t] = null; |
268 |
< |
tail = t; |
265 |
> |
if (result != null) { |
266 |
> |
elements[t] = null; |
267 |
> |
tail = t; |
268 |
> |
} |
269 |
|
return result; |
270 |
|
} |
271 |
|
|
901 |
|
throw new NullPointerException(); |
902 |
|
Object[] a = deq.elements; |
903 |
|
int m = a.length - 1, f = getFence(), i = index; |
904 |
< |
if (i != fence) { |
904 |
> |
if (i != f) { |
905 |
|
@SuppressWarnings("unchecked") E e = (E)a[i]; |
906 |
|
index = (i + 1) & m; |
907 |
|
if (e == null) |