I think another answer is outdated. You should probably check the following methods.
singleOrError: Emits the one and only element, IndexOutOfBoundsException if the source is longer than 1 item or a NoSuchElementException if the source is empty.
firstOrError: Emits the first element or a NoSuchElementException if the source is empty.
lastOrError: Emits the lastelement or a NoSuchElementException if the source is empty.
elementAtOrError: Emits the indexth element or a NoSuchElementException.
More info on this page: https://github.com/ReactiveX/RxJava/wiki/What%27s-different-in-2.0
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…