question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

doOnEmpty() Operator?

See original GitHub issue

Is it possible we can add an Observable.doOnEmpty() operator? Sometimes when I’m debugging or want to handle an empty Observable I’d like to raise an error, display a message, or some other action to handle the emptiness…

Observable<String> source = ...


source.doOnEmpty(() -> System.out.println("No items were emitted!")).subscribe(System.out::println);

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
thomasnieldcommented, Apr 14, 2016

Oh nice, that’s clever. And it doesn’t even require any custom Operator implementation.

I can go ahead and close this then. I’ve started using Kotlin with extension functions so it’s marginalized the need personally for me to put this in a centralized library.

0reactions
ZacSweerscommented, May 7, 2016

Android is supported by JetBrains, Kotlin is not officially supported by Android. It’s nice but not everyone is using Kotlin in their projects.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mono doOnEmpty in Reactor? - Stack Overflow
Is there any operator on Mono that would allow me to log fact that mono was empty? I cannot use hasElement() because I...
Read more >
RxJava: Custom Operators - Mouaad Aallam
Lets create the custom doOnEmpty() operator: it will execute an Action when onComplete() is called and no emissions have occurred.
Read more >
Implementing an ObservableOperator - Learning RxJava [Book]
Say, you want to create your own doOnEmpty() operator that will execute an Action when onComplete() is called and no emissions have occurred....
Read more >
reactor/reactor - Gitter
It seems the last position of ':' in forwarded header is used to extract and parse the following sequence without a catch and...
Read more >
Transformers (rxjava2-extras 0.1.38 API)
FlowableTransformer<T,T>, doOnEmpty(io.reactivex.functions.Action action) ... FlowableTransformer<T,Statistics> collectStats().
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found