Skip to content

Commit

Permalink
accumulating with scan
Browse files Browse the repository at this point in the history
  • Loading branch information
javiergamarra committed Nov 21, 2015
1 parent f84c073 commit 2a1f5e8
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions RxJavaInAction/src/com/nhpatt/rxjava/RxIsALibrary.java
Expand Up @@ -87,4 +87,18 @@ public void filteringResults() {
.subscribe(System.out::println);
}

@Test
public void accumulatingResults() {

service.listRepos("nhpatt")
.flatMap(Observable::from)
.map(Repo::getName)
.map((s) -> s.replace("-", " "))
.filter((s) -> s.startsWith("Android"))
.take(2)
.map(String::length)
.scan((x, y) -> x * y)
.subscribe(System.out::println);
}

}

0 comments on commit 2a1f5e8

Please sign in to comment.