What if we want only the fifth element emitted by an Observable sequence? elementAt()
function emits only the n element from a sequence, and then it completes.
What if we are looking for the fifth element but the Observable sequence only emitted three elements? We can use elementAtOrDefault()
, of course. The next figure shows how to cherry-pick the third element from a sequence by applying elementAt(2)
and creating a new Observable by emitting only this specific element:
3.21.93.20