src/main/java/io/reactivex/Observable.java
@SchedulerSupport(SchedulerSupport.NONE)
    public final void blockingForEach(Consumer<? super T> onNext) {
        Iterator<T> it = blockingIterable().iterator();
        while (it.hasNext()) {
            try {
                onNext.accept(it.next());
            } catch (Throwable e) {
                Exceptions.throwIfFatal(e);
                ((Disposable)it).dispose();
                throw ExceptionHelper.wrapOrThrow(e);
            }
        }
    }
@SchedulerSupport(SchedulerSupport.NONE)
    public final void blockingForEach(Consumer<? super T> onNext) {
        Iterator<T> it = blockingIterable().iterator();
        while (it.hasNext()) {
            try {
                onNext.accept(it.next());
            } catch (Throwable e) {
                Exceptions.throwIfFatal(e);
                ((Disposable)it).dispose();
                throw ExceptionHelper.wrapOrThrow(e);
            }
        }
    }
@ SchedulerSupport ( SchedulerSupport . NONE ) public final void blockingForEach ( Consumer < ? super T > onNext ) { Iterator < T > it = blockingIterable ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { try { onNext . accept ( it . next ( ) ) ; } catch ( Throwable e ) { Exceptions . throwIfFatal ( e ) ; ( ( Disposable ) it ) . dispose ( ) ; throw ExceptionHelper . wrapOrThrow ( e ) ; } } }
Consumes the upstream {@code Observable} in a blocking fashion and invokes the given
{@code Consumer} with each upstream item on the <em>current thread</em> until the
upstream terminates.
<p>
<img width="640" height="330" src="https://github.com/ReactiveX/RxJava/wiki/images/rx-operators/blockingForEach.o.png" alt="">
<p>
<em>Note:</em> the method will only return if the upstream terminates or the current
thread is interrupted.
<p>
This method executes the {@code Consumer} on the current thread while
{@link #subscribe(Consumer)} executes the consumer on the original caller thread of the
sequence.
<dl>
<dt><b>Scheduler:</b></dt>
<dd>{@code blockingForEach} does not operate by default on a particular {@link Scheduler}.</dd>
<dt><b>Error handling:</b></dt>
<dd>If the source signals an error, the operator wraps a checked {@link Exception}
into {@link RuntimeException} and throws that. Otherwise, {@code RuntimeException}s and
{@link Error}s are rethrown as they are.</dd>
</dl>

@param onNext
the {@link Consumer} to invoke for each item emitted by the {@code Observable}
@throws RuntimeException
if an error occurs
@see <a href="http://reactivex.io/documentation/operators/subscribe.html">ReactiveX documentation: Subscribe</a>
@see #subscribe(Consumer)
Consumes the upstream { @code Observable } in a blocking fashion and invokes the given { @code Consumer } with each upstream item on the <em > current thread< / em > until the upstream terminates . <p > <img width = 640 height = 330 src = https : // github . com / ReactiveX / RxJava / wiki / images / rx - operators / blockingForEach . o . png alt = > <p > <em > Note : < / em > the method will only return if the upstream terminates or the current thread is interrupted . <p > This method executes the { @code Consumer } on the current thread while { @link #subscribe ( Consumer ) } executes the consumer on the original caller thread of the sequence . <dl > <dt > <b > Scheduler : < / b > < / dt > <dd > { @code blockingForEach } does not operate by default on a particular { @link Scheduler } . < / dd > <dt > <b > Error handling : < / b > < / dt > <dd > If the source signals an error the operator wraps a checked { @link Exception } into { @link RuntimeException } and throws that . Otherwise { @code RuntimeException } s and { @link Error } s are rethrown as they are . < / dd > < / dl >