Skip to content

Commit 8760658

Browse files
committed
Update 4. Aggregation.md
1 parent 3fee7b0 commit 8760658

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Part 2 - Sequence Basics/4. Aggregation.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ Single1: 5
103103
Single1: Completed
104104
```
105105

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`
107107

108108
## Custom aggregators
109109

110110
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.
111111

112112
### reduce
113113

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.
115115

116116
```java
117117
public final Observable<T> reduce(Func2<T,T,T> accumulator)
@@ -279,7 +279,7 @@ values
279279
[10, 11, 12, 13, 14]
280280
```
281281

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.
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.
283283

284284
#### toList
285285

@@ -314,7 +314,7 @@ values
314314
.toSortedList((i1,i2) -> i2 - i1)
315315
.subscribe(v -> System.out.println(v));
316316
```
317-
[Output]((/tests/java/itrx/chapter2/aggregation/ToCollectionExample.java)
317+
[Output](/tests/java/itrx/chapter2/aggregation/ToCollectionExample.java)
318318
```
319319
[14, 13, 12, 11, 10]
320320
```
@@ -533,7 +533,7 @@ Nested observables may be confusing at first, but they are a powerful construct
533533
* Partitions of Data
534534
* 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.
535535
* 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.
537537
* Financial data streams
538538
* New markets or instruments may open and close during the day. These would then stream price information and could complete when the market closes.
539539
* Chat Room
@@ -543,7 +543,7 @@ Nested observables may be confusing at first, but they are a powerful construct
543543

544544
### nest
545545

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.
547547

548548
![](https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/nest.png)
549549

0 commit comments

Comments
 (0)