@@ -200,16 +200,6 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
200
200
Observable [(T , U )](JObservable .zip[T , U , (T , U )](this .asJava, that.asJava, (t : T , u : U ) => (t, u)))
201
201
}
202
202
203
- // There is no method corresponding to
204
- // public static <T> Observable<Boolean> sequenceEqual(Observable<? extends T> first, Observable<? extends T> second)
205
- // because the Scala-idiomatic way of doing this is
206
- // (first zip second) map (p => p._1 == p._2)
207
-
208
- // There is no method corresponding to
209
- // public static <T> Observable<Boolean> sequenceEqual(Observable<? extends T> first, Observable<? extends T> second, Func2<? super T, ? super T, Boolean> equality)
210
- // because the Scala-idiomatic way of doing this is
211
- // (first zip second) map (p => equality(p._1, p._2))
212
-
213
203
/**
214
204
* Creates an Observable which produces buffers of collected values.
215
205
*
@@ -673,10 +663,6 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
673
663
Observable [R ](asJava.flatMap[R ]((t : T ) => f(t).asJava))
674
664
}
675
665
676
- // There is no method like
677
- // public Observable<T> where(Func1<? super T, Boolean> predicate)
678
- // because that's called filter in Scala.
679
-
680
666
/**
681
667
* Returns an Observable that applies the given function to each item emitted by an
682
668
* Observable and emits the result.
@@ -692,10 +678,6 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
692
678
Observable [R ](asJava.map[R ](func))
693
679
}
694
680
695
- // There's no method like
696
- // public <R> Observable<R> mapMany(Func1<? super T, ? extends Observable<? extends R>> func)
697
- // because that's called flatMap in Scala.
698
-
699
681
/**
700
682
* Turns all of the notifications from a source Observable into {@link Observer#onNext onNext} emissions, and marks them with their original notification types within {@link Notification} objects.
701
683
* <p>
@@ -948,10 +930,6 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
948
930
(() => javaCO.connect(), Observable [T ](javaCO))
949
931
}
950
932
951
- // There is no aggregate function with signature
952
- // public Observable<T> aggregate(Func2<? super T, ? super T, ? extends T> accumulator)
953
- // because that's called reduce in Scala.
954
-
955
933
// TODO add Scala-like aggregate function
956
934
957
935
/**
@@ -980,13 +958,6 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
980
958
def fold [R ](initialValue : R )(accumulator : (R , T ) => R ): Observable [R ] = {
981
959
Observable [R ](asJava.reduce(initialValue, accumulator))
982
960
}
983
- // corresponds to Java's
984
- // public <R> Observable<R> reduce(R initialValue, Func2<? super R, ? super T, ? extends R> accumulator)
985
- // public <R> Observable<R> aggregate(R initialValue, Func2<? super R, ? super T, ? extends R> accumulator)
986
-
987
- // There is no method like
988
- // public Observable<T> scan(Func2<? super T, ? super T, ? extends T> accumulator)
989
- // because scan has a seed in Scala
990
961
991
962
/**
992
963
* Returns an Observable that emits the results of sampling the items emitted by the source
@@ -1024,7 +995,7 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
1024
995
Observable [T ](asJava.sample(duration.length, duration.unit, scheduler))
1025
996
}
1026
997
1027
- /**
998
+ /**
1028
999
* Returns an Observable that applies a function of your choosing to the first item emitted by a
1029
1000
* source Observable, then feeds the result of that function along with the second item emitted
1030
1001
* by an Observable into the same function, and so on until all items have been emitted by the
@@ -1048,8 +1019,6 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
1048
1019
def scan [R ](initialValue : R )(accumulator : (R , T ) => R ): Observable [R ] = {
1049
1020
Observable [R ](asJava.scan(initialValue, accumulator))
1050
1021
}
1051
- // corresponds to Scala's
1052
- // public <R> Observable<R> scan(R initialValue, Func2<? super R, ? super T, ? extends R> accumulator)
1053
1022
1054
1023
/**
1055
1024
* Returns an Observable that emits a Boolean that indicates whether all of the items emitted by
@@ -1068,8 +1037,6 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
1068
1037
// it's more fun in Scala:
1069
1038
this .map(predicate).fold(true )(_ && _)
1070
1039
}
1071
- // corresponds to Java's
1072
- // public Observable<Boolean> all(Func1<? super T, Boolean> predicate)
1073
1040
1074
1041
/**
1075
1042
* Returns an Observable that skips the first <code>num</code> items emitted by the source
@@ -1088,8 +1055,6 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
1088
1055
def drop (n : Int ): Observable [T ] = {
1089
1056
Observable [T ](asJava.skip(n))
1090
1057
}
1091
- // corresponds to Java's
1092
- // public Observable<T> skip(int num)
1093
1058
1094
1059
/**
1095
1060
* Returns an Observable that emits only the first <code>num</code> items emitted by the source
@@ -1165,8 +1130,6 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
1165
1130
def takeRight (n : Int ): Observable [T ] = {
1166
1131
Observable [T ](asJava.takeLast(n))
1167
1132
}
1168
- // corresponds to Java's
1169
- // public Observable<T> takeLast(final int count)
1170
1133
1171
1134
/**
1172
1135
* Returns an Observable that emits the items from the source Observable only until the
@@ -1207,16 +1170,6 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
1207
1170
Observable .jObsOfListToScObsOfSeq(asJava.toList())
1208
1171
: Observable [Seq [T ]] // SI-7818
1209
1172
}
1210
- // corresponds to Java's method
1211
- // public Observable<List<T>> toList() {
1212
-
1213
- // There are no toSortedList methods because Scala can sort itself
1214
- // public Observable<List<T>> toSortedList()
1215
- // public Observable<List<T>> toSortedList(Func2<? super T, ? super T, Integer> sortFunction)
1216
-
1217
- // There is no method
1218
- // def startWith[U >: T](values: U*): Observable[U]
1219
- // because we can just use ++ instead
1220
1173
1221
1174
/**
1222
1175
* Groups the items emitted by this Observable according to a specified discriminator function.
@@ -1233,10 +1186,6 @@ class Observable[+T](val asJava: rx.Observable[_ <: T])
1233
1186
val func = (o : rx.observables.GroupedObservable [K , _ <: T ]) => (o.getKey(), Observable [T ](o))
1234
1187
Observable [(K , Observable [T ])](o1.map[(K , Observable [T ])](func))
1235
1188
}
1236
-
1237
- // There's no method corresponding to
1238
- // public <K, R> Observable<GroupedObservable<K, R>> groupBy(final Func1<? super T, ? extends K> keySelector, final Func1<? super T, ? extends R> elementSelector)
1239
- // because this can be obtained by combining groupBy and map (as in Scala)
1240
1189
1241
1190
/**
1242
1191
* Given an Observable that emits Observables, creates a single Observable that
@@ -1505,12 +1454,6 @@ object Observable {
1505
1454
def apply [T ](func : Observer [T ] => Subscription ): Observable [T ] = {
1506
1455
Observable [T ](JObservable .create(func))
1507
1456
}
1508
- // corresponds to Java's
1509
- // public static <T> Observable<T> create(OnSubscribeFunc<T> func)
1510
-
1511
- // Java's
1512
- // public static <T> Observable<T> empty()
1513
- // is not needed in Scala because it's a special case of varargs apply
1514
1457
1515
1458
/**
1516
1459
* Returns an Observable that invokes an {@link Observer}'s {@link Observer#onError onError} method when the Observer subscribes to it
@@ -1526,12 +1469,6 @@ object Observable {
1526
1469
def apply (exception : Throwable ): Observable [Nothing ] = {
1527
1470
Observable [Nothing ](JObservable .error(exception))
1528
1471
}
1529
- // corresponds to Java's
1530
- // public static <T> Observable<T> error(Throwable exception)
1531
-
1532
- // There is no method corresponding to
1533
- // public static <T> Observable<T> from(Iterable<? extends T> iterable)
1534
- // because Scala automatically uses the varargs apply for this
1535
1472
1536
1473
/**
1537
1474
* Converts a sequence of values into an Observable.
@@ -1551,18 +1488,11 @@ object Observable {
1551
1488
def apply [T ](args : T * ): Observable [T ] = {
1552
1489
Observable [T ](JObservable .from(args.toIterable.asJava))
1553
1490
}
1554
- // corresponds to Java's
1555
- // public static <T> Observable<T> from(T... items)
1556
1491
1557
1492
def apply (range : Range ): Observable [Int ] = {
1558
1493
Observable [Int ](JObservable .from(range.toIterable.asJava))
1559
1494
}
1560
1495
1561
- // There is no method corresponding to
1562
- // public static Observable<Integer> range(int start, int count)
1563
- // because the Scala collection library provides enough methods to create Iterables.
1564
- // Examples: Observable(1 to 5), Observable(1 until 10)
1565
-
1566
1496
/**
1567
1497
* Returns an Observable that calls an Observable factory to create its Observable for each
1568
1498
* new Observer that subscribes. That is, for each subscriber, the actuall Observable is determined
@@ -1586,8 +1516,6 @@ object Observable {
1586
1516
def defer [T ](observable : => Observable [T ]): Observable [T ] = {
1587
1517
Observable [T ](JObservable .defer(observable.asJava))
1588
1518
}
1589
- // corresponds to Java's
1590
- // public static <T> Observable<T> defer(Func0<? extends Observable<? extends T>> observableFactory)
1591
1519
1592
1520
/**
1593
1521
* Returns an Observable that emits a single item and then completes.
@@ -1611,16 +1539,10 @@ object Observable {
1611
1539
def just [T ](value : T ): Observable [T ] = {
1612
1540
Observable [T ](JObservable .just(value))
1613
1541
}
1614
- // corresponds to Java's
1615
- // public static <T> Observable<T> just(T value)
1616
1542
1617
1543
// TODO we have merge and concat (++) as binary instance methods, but do we also need them as
1618
1544
// static methods with arity > 2?
1619
1545
1620
- // There is no method corresponding to
1621
- // public static <T> Observable<T> concat(Observable<? extends T>... source)
1622
- // because we have the instance method ++ instead
1623
-
1624
1546
/**
1625
1547
* This behaves like {@link #merge(java.util.List)} except that if any of the merged Observables
1626
1548
* notify of an error via {@link Observer#onError onError}, {@code mergeDelayError} will
@@ -1703,49 +1625,23 @@ object Observable {
1703
1625
Observable [Nothing ](JObservable .never())
1704
1626
}
1705
1627
1706
- // There is no method corresponding to
1707
- // public static <T> Observable<T> switchDo(Observable<? extends Observable<? extends T>> sequenceOfSequences)
1708
- // because it's deprecated.
1709
-
1710
- // There's no
1711
- // public static <T> Observable<T> switchOnNext(Observable<? extends Observable<? extends T>> sequenceOfSequences)
1712
- // here because that's an instance method.
1713
-
1714
- // There is no method here corresponding to
1715
- // public static <T> Observable<T> synchronize(Observable<? extends T> observable)
1716
- // because that's an instance method.
1717
-
1718
1628
/*
1719
1629
def apply[T](f: Future[T]): Observable[T] = {
1720
1630
??? // TODO convert Scala Future to Java Future
1721
1631
}
1722
1632
*/
1723
- // corresponds to
1724
- // public static <T> Observable<T> from(Future<? extends T> future)
1725
1633
1726
1634
/*
1727
1635
def apply[T](f: Future[T], scheduler: Scheduler): Observable[T] = {
1728
1636
??? // TODO convert Scala Future to Java Future
1729
1637
}
1730
1638
*/
1731
- // public static <T> Observable<T> from(Future<? extends T> future, Scheduler scheduler)
1732
1639
1733
1640
/*
1734
1641
def apply[T](f: Future[T], duration: Duration): Observable[T] = {
1735
1642
??? // TODO convert Scala Future to Java Future
1736
1643
}
1737
1644
*/
1738
- // corresponds to
1739
- // public static <T> Observable<T> from(Future<? extends T> future, long timeout, TimeUnit unit)
1740
-
1741
- // There is no method here corresponding to
1742
- // public static <T1, T2, R> Observable<R> zip(Observable<? extends T1> o1, Observable<? extends T2> o2, Func2<? super T1, ? super T2, ? extends R> zipFunction)
1743
- // because it's an instance method
1744
-
1745
- // There is no method corresponding to
1746
- // public static <T1, T2, T3, R> Observable<R> zip(Observable<? extends T1> o1, Observable<? extends T2> o2, Observable<? extends T3> o3, Func3<? super T1, ? super T2, ? super T3, ? extends R> zipFunction)
1747
- // because zip3 is not known in the Scala world
1748
- // Also applies to all zipN with N > 3 ;-)
1749
1645
1750
1646
/**
1751
1647
* Combines the given observables, emitting an event containing an aggregation of the latest values of each of the source observables
0 commit comments