You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Part 2 - Sequence Basics/4. Aggregation.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -103,15 +103,15 @@ Single1: 5
103
103
Single1: Completed
104
104
```
105
105
106
-
Like in with previous methods, you can have a default value with `singleOrDefault`
106
+
Like in the previous methods, you can have a default value with `singleOrDefault`
107
107
108
108
## Custom aggregators
109
109
110
110
The methods we saw on this chapter so far don't seem that different from the ones in previous chapters. We will now see two very powerful methods that will greatly expand what we can do with an observable. Many of the methods we've seen so far can be implemented using those.
111
111
112
112
### reduce
113
113
114
-
You may have heard of `reduce` from MapReduce. Alternatively, you might have met it under the names "aggregate", "accumulate" or "fold". The general idea is that you produce a single value out of many by combining them two at a time. It its most basic overload, all you need is a function that combines two values into one.
114
+
You may have heard of `reduce` from [MapReduce] (https://en.wikipedia.org/wiki/MapReduce). Alternatively, you might have met it under the names "aggregate", "accumulate" or "fold". The general idea is that you produce a single value out of many by combining them two at a time. In its most basic overload, all you need is a function that combines two values into one.
Usually, you won't have to collect values manually. Rxjava offers a variety of operators for collecting your sequence into a container. Those aggregators return an observable that will emit the corresponding collection when it is ready, just like what we did here. We will see such aggregators next.
282
+
Usually, you won't have to collect values manually. RxJava offers a variety of operators for collecting your sequence into a container. Those aggregators return an observable that will emit the corresponding collection when it is ready, just like what we did here. We will see such aggregators next.
@@ -533,7 +533,7 @@ Nested observables may be confusing at first, but they are a powerful construct
533
533
* Partitions of Data
534
534
* You may partition data from a single source so that it can easily be filtered and shared to many sources. Partitioning data may also be useful for aggregates as we have seen. This is commonly done with the `groupBy` operator.
535
535
* Online Game servers
536
-
* Consider a sequence of servers. New values represent a server coming online. The value itself is a sequence of latency values allowing the consumer to see real time information of quantity and quality of servers available. If a server went down then the inner sequence can signify that by completing.
536
+
* Consider a sequence of servers. New values represent a server coming online. The value itself is a sequence of latency values allowing the consumer to see real time information of quantity and quality of servers available. If a server went down then the inner sequence can signal that by completing.
537
537
* Financial data streams
538
538
* New markets or instruments may open and close during the day. These would then stream price information and could complete when the market closes.
539
539
* Chat Room
@@ -543,7 +543,7 @@ Nested observables may be confusing at first, but they are a powerful construct
543
543
544
544
### nest
545
545
546
-
When dealing with nested observables, the `nest` operator becomes useful. It allows you to turn a non-nested observable into a nested observable. `nest` takes a source observable and returns an observable that will the source observable and then terminate.
546
+
When dealing with nested observables, the `nest` operator becomes useful. It allows you to turn a non-nested observable into a nested observable. `nest` takes a source observable and returns an observable that will be the source observable and then terminate.
0 commit comments