예제 #1
0
 /**
  * Returns the last item emitted by a specified {@link Observable} that matches a predicate, or
  * throws <code>NoSuchElementException</code> if it emits no such items.
  *
  * <p><img width="640"
  * src="https://github.com/Netflix/RxJava/wiki/images/rx-operators/B.last.p.png">
  *
  * @param predicate a predicate function to evaluate items emitted by the {@link Observable}
  * @return the last item emitted by the {@link Observable} that matches the predicate
  * @throws NoSuchElementException if no such items are emitted
  * @see <a
  *     href="https://github.com/Netflix/RxJava/wiki/Blocking-Observable-Operators#last-and-lastordefault">RxJava
  *     Wiki: last()</a>
  * @see <a
  *     href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.last.aspx">MSDN:
  *     Observable.Last</a>
  */
 public T last(final Func1<? super T, Boolean> predicate) {
   return from(o.last(predicate)).single();
 }
예제 #2
0
 /**
  * Returns the last item emitted by a specified {@link Observable}, or throws <code>
  * NoSuchElementException</code> if it emits no items.
  *
  * <p><img width="640"
  * src="https://github.com/Netflix/RxJava/wiki/images/rx-operators/B.last.png">
  *
  * @return the last item emitted by the source {@link Observable}
  * @throws NoSuchElementException if source contains no elements
  * @see <a
  *     href="https://github.com/Netflix/RxJava/wiki/Blocking-Observable-Operators#last-and-lastordefault">RxJava
  *     Wiki: last()</a>
  * @see <a
  *     href="http://msdn.microsoft.com/en-us/library/system.reactive.linq.observable.last.aspx">MSDN:
  *     Observable.Last</a>
  */
 public T last() {
   return from(o.last()).single();
 }