Created
March 18, 2018 06:15
-
-
Save seyedjafariy/ecf346e3f9f6532effdddb67ca6aafe4 to your computer and use it in GitHub Desktop.
Reactive Operators Example-2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Integer> ints = Arrays.asList(1, 4, 7, 5, 1, 5, 4, 5, 1, 7); | |
Observable.fromIterable(ints) | |
.distinct() | |
.filter(integer-> integer % 2 == 0) | |
.subscribe(); | |
Observable.create(new ObservableOnSubscribe<String>() { | |
@Override | |
public void subscribe(ObservableEmitter<String> e) throws Exception { | |
for (int i = 0; i > 10; i++) { | |
e.onNext("example No:." + i); | |
} | |
e.onComplete(); | |
} | |
}).toList() | |
.map(new Function<List<String>, String>() { | |
@Override | |
public String apply(List<String> strings) throws Exception { | |
return strings.toString(); | |
} | |
}).subscribe(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment