/** * Loops over all elements of the array until a null element is encountered or * the given predicate returns true. * @param consumer the consumer of values that returns true if the forEach should terminate */ @SuppressWarnings("unchecked") public final void forEachWhile(NonThrowingPredicate<? super T> consumer) { Object[] a = head; final int c = capacity; while (a != null) { for (int i = 0; i < c; i++) { Object o = a[i]; if (o == null) { break; } if (consumer.test((T)o)) { break; } } a = (Object[])a[c]; } }
/** * Loops over all elements of the array until a null element is encountered or * the given predicate returns true. * @param consumer the consumer of values that returns true if the forEach should terminate */ @SuppressWarnings("unchecked") public final void forEachWhile(NonThrowingPredicate<? super T> consumer) { Object[] a = head; final int c = capacity; while (a != null) { for (int i = 0; i < c; i++) { Object o = a[i]; if (o == null) { break; } if (consumer.test((T)o)) { break; } } a = (Object[])a[c]; } }
/** * Loops over all elements of the array until a null element is encountered or * the given predicate returns true. * @param consumer the consumer of values that returns true if the forEach should terminate */ @SuppressWarnings("unchecked") public final void forEachWhile(NonThrowingPredicate<? super T> consumer) { Object[] a = head; final int c = capacity; while (a != null) { for (int i = 0; i < c; i++) { Object o = a[i]; if (o == null) { break; } if (consumer.test((T)o)) { break; } } a = (Object[])a[c]; } }