by veskoiliev | Jul 1, 2018 | Android, Development
RxJava has been gaining popularity in the past couple of years and today is widely adopted in the Android community. So much in fact that I can’t recall an Android developer interview in the past 3 years that doesn’t mention RxJava.
Here is a short list of the most common interview questions I have asked candidates (or been asked as an interviewee). Answers to all questions can be found further down.
read more
by veskoiliev | Jan 18, 2017 | Android, Development
1. Observable creation and error handling
Consider the following example:
public Observable<Book> getFavoriteBook(User user) {
return Observable.just(user.getFavoriteBookId())
.flatMap(bookId -> bookService.getById(bookId))
.onErrorReturn(throwable -> DEFAULT_FAVORITE_BOOK);
}
Focus on the error handling part. In my experience in 95% of the cases the expectation behind the statement .onErrorReturn(...);
is to ensure that the method getFavoriteBook()
is “safe”, e.g. that an exception cannot be thrown from it at all, as if it was surrounded by a giant try-catch.
read more