Top Description Inners Constructors Methods
rx.internal.operators

public final Class BlockingOperatorToIterator

extends Object
Class Inheritance
Imports
java.util.*, java.util.concurrent.*, rx.*, .Observable, rx.exceptions.Exceptions, rx.internal.util.RxRingBuffer

Returns an Iterator that iterates over all items emitted by a specified Observable.

See Also
Issue #50

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <
the type of source.
T
>
Iterator<T>

Returns:

the iterator that could be used to iterate over the elements of the observable.
toIterator
(Observable<? extends T>
the source Observable
source
)

Returns an iterator that iterates all values of the observable.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

BlockingOperatorToIteratorback to summary
private BlockingOperatorToIterator()

Method Detail

toIteratorback to summary
public static <T> Iterator<T> toIterator(Observable<? extends T> source)

Returns an iterator that iterates all values of the observable.

Parameters
<T>
the type of source.
source:Observable<? extends T>

the source Observable

Returns:Iterator<T>

the iterator that could be used to iterate over the elements of the observable.

Annotations
@SuppressWarnings:unchecked
rx.internal.operators back to summary

public final Class BlockingOperatorToIterator.SubscriberIterator<T>

extends Subscriber<Notification<? extends T>>
implements Iterator<T>
Class Inheritance
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private Notification<? extends T>
pack-priv static final int
private final BlockingQueue<Notification<? extends T>>
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
public T
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
public void
onCompleted()

Implements rx.Observer.onCompleted.

Notifies the Observer that the Observable has finished sending push-based notifications.
public void
onError(Throwable
the exception encountered by the Observable
e
)

Implements rx.Observer.onError.

Notifies the Observer that the Observable has experienced an error condition.
public void
onNext(Notification<? extends T>
the item emitted by the Observable
args
)

Implements rx.Observer.onNext.

Provides the Observer with a new item to observe.
public void
onStart()

Overrides rx.Subscriber.onStart.

This method is invoked when the Subscriber and Observable have been connected but the Observable has not yet begun to emit items or send notifications to the Subscriber.
public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).
private Notification<? extends T>
take()

Inherited from rx.Subscriber:
addisUnsubscribedrequestsetProducerunsubscribe

Field Detail

bufback to summary
private Notification<? extends T> buf
LIMITback to summary
pack-priv static final int LIMIT
notificationsback to summary
private final BlockingQueue<Notification<? extends T>> notifications
receivedback to summary
private int received

Constructor Detail

SubscriberIteratorback to summary
public SubscriberIterator()

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public T next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:T

the next element in the iteration

Annotations
@Override
onCompletedback to summary
public void onCompleted()

Implements rx.Observer.onCompleted.

Doc from rx.Observer.onCompleted.

Notifies the Observer that the Observable has finished sending push-based notifications.

The Observable will not call this method if it calls onError.

Annotations
@Override
onErrorback to summary
public void onError(Throwable e)

Implements rx.Observer.onError.

Doc from rx.Observer.onError.

Notifies the Observer that the Observable has experienced an error condition.

If the Observable calls this method, it will not thereafter call onNext or onCompleted.

Parameters
e:Throwable

the exception encountered by the Observable

Annotations
@Override
onNextback to summary
public void onNext(Notification<? extends T> args)

Implements rx.Observer.onNext.

Doc from rx.Observer.onNext.

Provides the Observer with a new item to observe.

The Observable may call this method 0 or more times.

The Observable will not call this method again after it calls either onCompleted or onError.

Parameters
args:Notification<? extends T>

the item emitted by the Observable

Annotations
@Override
onStartback to summary
public void onStart()

Overrides rx.Subscriber.onStart.

Doc from rx.Subscriber.onStart.

This method is invoked when the Subscriber and Observable have been connected but the Observable has not yet begun to emit items or send notifications to the Subscriber. Override this method to add any useful initialization to your subscription, for instance to initiate backpressure.

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override
takeback to summary
private Notification<? extends T> take()