12
12
*/
13
13
package rx ;
14
14
15
- import static rx .functions .Functions .* ;
15
+ import static rx .functions .Functions .alwaysFalse ;
16
16
17
17
import java .util .ArrayList ;
18
18
import java .util .Arrays ;
115
115
import rx .operators .OperatorOnErrorFlatMap ;
116
116
import rx .operators .OperatorOnErrorResumeNextViaFunction ;
117
117
import rx .operators .OperatorParallel ;
118
+ import rx .operators .OperatorPivot ;
118
119
import rx .operators .OperatorRepeat ;
119
120
import rx .operators .OperatorRetry ;
120
121
import rx .operators .OperatorScan ;
@@ -1640,8 +1641,18 @@ public final static Observable<Long> interval(long interval, TimeUnit unit, Sche
1640
1641
* @return an Observable that emits {@code value} as a single item and then completes
1641
1642
* @see <a href="https://github.com/Netflix/RxJava/wiki/Creating-Observables#wiki-just">RxJava Wiki: just()</a>
1642
1643
*/
1643
- public final static <T > Observable <T > just (T value ) {
1644
- return from (Arrays .asList (value ));
1644
+ public final static <T > Observable <T > just (final T value ) {
1645
+ return Observable .create (new OnSubscribe <T >() {
1646
+
1647
+ @ Override
1648
+ public void call (Subscriber <? super T > s ) {
1649
+ if (!s .isUnsubscribed ()) {
1650
+ s .onNext (value );
1651
+ s .onCompleted ();
1652
+ }
1653
+ }
1654
+
1655
+ });
1645
1656
}
1646
1657
1647
1658
/**
@@ -1664,7 +1675,7 @@ public final static <T> Observable<T> just(T value) {
1664
1675
*/
1665
1676
@ Deprecated
1666
1677
public final static <T > Observable <T > just (T value , Scheduler scheduler ) {
1667
- return from ( Arrays . asList (( value )), scheduler );
1678
+ return just ( value ). subscribeOn ( scheduler );
1668
1679
}
1669
1680
1670
1681
/**
@@ -2410,7 +2421,7 @@ public final static <T extends Comparable<? super T>> Observable<T> min(Observab
2410
2421
* @return an Observable that emits a single item: the source Observable
2411
2422
*/
2412
2423
public final Observable <Observable <T >> nest () {
2413
- return from (this );
2424
+ return just (this );
2414
2425
}
2415
2426
2416
2427
/**
@@ -2477,6 +2488,16 @@ public final static <T> Observable<Observable<T>> parallelMerge(Observable<Obser
2477
2488
return OperationParallelMerge .parallelMerge (source , parallelObservables , scheduler );
2478
2489
}
2479
2490
2491
+ /**
2492
+ * Pivot GroupedObservable streams without serializing/synchronizing to a single stream first.
2493
+ *
2494
+ * @param groups
2495
+ * @return
2496
+ */
2497
+ public static final <K1 , K2 , T > Observable <GroupedObservable <K2 , GroupedObservable <K1 , T >>> pivot (Observable <GroupedObservable <K1 , GroupedObservable <K2 , T >>> groups ) {
2498
+ return groups .lift (new OperatorPivot <K1 , K2 , T >());
2499
+ }
2500
+
2480
2501
/**
2481
2502
* Returns an Observable that emits a sequence of Integers within a specified range.
2482
2503
* <p>
0 commit comments