@@ -565,6 +565,43 @@ trait Observable[+T]
565
565
Observable .jObsOfListToScObsOfSeq(oJava.asInstanceOf [rx.Observable [_ <: java.util.List [T ]]])
566
566
}
567
567
568
+ /**
569
+ * Returns an Observable that emits non-overlapping buffered items from the source Observable each time the
570
+ * specified boundary Observable emits an item.
571
+ * <p>
572
+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/buffer8.png">
573
+ * <p>
574
+ * Completion of either the source or the boundary Observable causes the returned Observable to emit the
575
+ * latest buffer and complete.
576
+ *
577
+ * @param boundary the boundary Observable
578
+ * @return an Observable that emits buffered items from the source Observable when the boundary Observable
579
+ * emits an item
580
+ */
581
+ def buffer (boundary : Observable [Any ]): Observable [Seq [T ]] = {
582
+ val thisJava = this .asJavaObservable.asInstanceOf [rx.Observable [T ]]
583
+ toScalaObservable(thisJava.buffer(boundary.asJavaObservable)).map(_.asScala)
584
+ }
585
+
586
+ /**
587
+ * Returns an Observable that emits non-overlapping buffered items from the source Observable each time the
588
+ * specified boundary Observable emits an item.
589
+ * <p>
590
+ * <img width="640" src="https://raw.github.com/wiki/Netflix/RxJava/images/rx-operators/buffer8.png">
591
+ * <p>
592
+ * Completion of either the source or the boundary Observable causes the returned Observable to emit the
593
+ * latest buffer and complete.
594
+ *
595
+ * @param boundary the boundary Observable
596
+ * @param initialCapacity the initial capacity of each buffer chunk
597
+ * @return an Observable that emits buffered items from the source Observable when the boundary Observable
598
+ * emits an item
599
+ */
600
+ def buffer (boundary : Observable [Any ], initialCapacity : Int ): Observable [Seq [T ]] = {
601
+ val thisJava = this .asJavaObservable.asInstanceOf [rx.Observable [T ]]
602
+ toScalaObservable(thisJava.buffer(boundary.asJavaObservable, initialCapacity)).map(_.asScala)
603
+ }
604
+
568
605
/**
569
606
* Creates an Observable which produces windows of collected values. This Observable produces connected
570
607
* non-overlapping windows. The current window is emitted and replaced with a new window when the
0 commit comments