# | Line 608 | Line 608 | public class ArrayDeque<E> extends Abstr | |
---|---|---|
608 | } | |
609 | lastRet = -1; | |
610 | } | |
611 | + | |
612 | + | public void forEachRemaining(Consumer<? super E> action) { |
613 | + | Objects.requireNonNull(action); |
614 | + | Object[] a = elements; |
615 | + | int m = a.length - 1, f = fence, i = cursor; |
616 | + | cursor = f; |
617 | + | while (i != f) { |
618 | + | @SuppressWarnings("unchecked") E e = (E)a[i]; |
619 | + | i = (i + 1) & m; |
620 | + | if (e == null) |
621 | + | throw new ConcurrentModificationException(); |
622 | + | action.accept(e); |
623 | + | } |
624 | + | } |
625 | } | |
626 | ||
627 | /** |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |