Observable<POJO> localRequest = Database.getInstance(this.context).getAllQuestions().flatMapObservable((questions) -> {
ContentHolder.getHolder().setQuestionMap(questions);
return Observer::onComplete;
});
public Maybe<Question[]> getAllQuestions () {
}
I cannot understand the line of return Observer::onComplete;
Advertisement
Answer
It’s a fancy and incorrect way of doing an empty result á la Observable.empty().
fatMapObservable expects an Observable<POJO> as its return due to target typing. Since Observable is a single abstract method type, you can use a lambda expression to construct an instance of it. I.e., have the subscribe(Observer<POJO>) method implemented via observer -> observer.onComplete() or Observer::onComplete.