Created
January 4, 2017 04:42
-
-
Save rohmanhakim/c6b8473dca2a71c812bb911b5406e6ba to your computer and use it in GitHub Desktop.
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
// Ambil daftar email dari APi, kemudian cek apakah email user sudah dipakai | |
public Observable<Boolean> checkIfEmailExistFromAPI(final String input){ | |
return service.getEmails() | |
.flatMap(new Func1<List<String>, Observable<String>>() { // Mengubah stream of List<String> menjadi stream of String | |
@Override | |
public Observable<String> call(List<String> strings) { | |
return Observable.from(strings); | |
} | |
}).contains(input); // Cek apakah email di emit oleh stream sebelumnya | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment