@@ -1038,7 +1038,7 @@ class Observable[+T] private[scala] (val asJava: rx.Observable[_ <: T])
1038
1038
* @return an Observable that emits a single item that is the result of accumulating the output
1039
1039
* from the items emitted by the source Observable
1040
1040
*/
1041
- def fold [R ](initialValue : R )(accumulator : (R , T ) => R ): Observable [R ] = {
1041
+ def foldLeft [R ](initialValue : R )(accumulator : (R , T ) => R ): Observable [R ] = {
1042
1042
Observable [R ](asJava.reduce(initialValue, accumulator))
1043
1043
}
1044
1044
@@ -1117,7 +1117,7 @@ class Observable[+T] private[scala] (val asJava: rx.Observable[_ <: T])
1117
1117
// type mismatch; found : rx.Observable[java.lang.Boolean] required: rx.Observable[_ <: scala.Boolean]
1118
1118
// new Observable[Boolean](asJava.all(predicate))
1119
1119
// it's more fun in Scala:
1120
- this .map(predicate).fold (true )(_ && _)
1120
+ this .map(predicate).foldLeft (true )(_ && _)
1121
1121
}
1122
1122
1123
1123
/**
@@ -1566,7 +1566,7 @@ class Observable[+T] private[scala] (val asJava: rx.Observable[_ <: T])
1566
1566
* @inheritdoc
1567
1567
*/
1568
1568
def sum [U >: T ](implicit num : Numeric [U ]): Observable [U ] = {
1569
- fold (num.zero)(num.plus)
1569
+ foldLeft (num.zero)(num.plus)
1570
1570
}
1571
1571
1572
1572
/**
@@ -1582,7 +1582,7 @@ class Observable[+T] private[scala] (val asJava: rx.Observable[_ <: T])
1582
1582
* @inheritdoc
1583
1583
*/
1584
1584
def product [U >: T ](implicit num : Numeric [U ]): Observable [U ] = {
1585
- fold (num.one)(num.times)
1585
+ foldLeft (num.one)(num.times)
1586
1586
}
1587
1587
1588
1588
/**
@@ -1598,7 +1598,7 @@ class Observable[+T] private[scala] (val asJava: rx.Observable[_ <: T])
1598
1598
* if the source Observable completes without emitting any item.
1599
1599
*/
1600
1600
def firstOrElse [U >: T ](default : => U ): Observable [U ] = {
1601
- this .take(1 ).fold [Option [U ]](None )((v : Option [U ], e : U ) => Some (e)).map({
1601
+ this .take(1 ).foldLeft [Option [U ]](None )((v : Option [U ], e : U ) => Some (e)).map({
1602
1602
case Some (element) => element
1603
1603
case None => default
1604
1604
})
0 commit comments