Created
October 1, 2018 16:27
-
-
Save CoderJava/93ee0a1b2ed7c55eb16f98d134366d38 to your computer and use it in GitHub Desktop.
Transforming Operator groupBy
This file contains hidden or 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
| public class RxTransformingOperatorGroupBy { | |
| public static void main(String[] args) { | |
| Observable.range(1, 9) | |
| .groupBy(item -> item % 2 == 0 ? "Genap" : "Ganji") | |
| .subscribe(groupObservable -> { | |
| if (groupObservable.getKey().equalsIgnoreCase("Genap")) { | |
| System.out.println("Emit bilangan genap"); | |
| System.out.println("List bilangan genap adalah sebagai berikut."); | |
| groupObservable.subscribe(System.out::println); | |
| } else { | |
| System.out.println("Emit bilangan ganjil"); | |
| } | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment