RxJava
rx.operators
Class OperationElementAt
java.lang.Object
rx.operators.OperationElementAt
public class OperationElementAt
- extends java.lang.Object
Returns the element at a specified index in a sequence.
|
Method Summary |
static
|
elementAt(Observable<? extends T> source,
int index)
Returns the element at a specified index in a sequence. |
static
|
elementAtOrDefault(Observable<? extends T> source,
int index,
T defaultValue)
Returns the element at a specified index in a sequence or the default
value if the index is out of range. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OperationElementAt
public OperationElementAt()
elementAt
public static <T> Observable.OnSubscribeFunc<T> elementAt(Observable<? extends T> source,
int index)
- Returns the element at a specified index in a sequence.
- Parameters:
source - Observable sequence to return the element from.index - The zero-based index of the element to retrieve.
- Returns:
- An observable sequence that produces the element at the specified
position in the source sequence.
- Throws:
java.lang.IndexOutOfBoundsException - Index is greater than or equal to the number of elements in
the source sequence.
java.lang.IndexOutOfBoundsException - Index is less than 0.
elementAtOrDefault
public static <T> Observable.OnSubscribeFunc<T> elementAtOrDefault(Observable<? extends T> source,
int index,
T defaultValue)
- Returns the element at a specified index in a sequence or the default
value if the index is out of range.
- Parameters:
source - Observable sequence to return the element from.index - The zero-based index of the element to retrieve.defaultValue - The default value.
- Returns:
- An observable sequence that produces the element at the specified
position in the source sequence, or the default value if the
index is outside the bounds of the source sequence.
- Throws:
java.lang.IndexOutOfBoundsException - Index is less than 0.