Last active
March 15, 2019 01:00
-
-
Save mitchtabian/fdd266445ee0c46d152a69591355c810 to your computer and use it in GitHub Desktop.
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
Observable<Task> taskObservable = Observable | |
.fromIterable(DataSource.createTasksList()) | |
.filter(new Predicate<Task>() { | |
@Override | |
public boolean test(Task task) throws Exception { | |
return task.isComplete(); | |
} | |
}) | |
.subscribeOn(Schedulers.io()) | |
.observeOn(AndroidSchedulers.mainThread()); | |
taskObservable.subscribe(new Observer<Task>() { | |
@Override | |
public void onSubscribe(Disposable d) { | |
} | |
@Override | |
public void onNext(Task task) { | |
Log.d(TAG, "onNext: This is a completed task: " + task.getDescription()); | |
} | |
@Override | |
public void onError(Throwable e) { | |
} | |
@Override | |
public void onComplete() { | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment