Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 3
    Doesn't that though require TryDequeue to return some marker interface with a Message implementation and some "nothing" implementation? Sure, it's more elegant at the call-site, but you're stuck implementing 3 implementations in the actual code, which itself may be impossible if Message is an existing type. Commented Mar 16, 2017 at 18:06
  • 1
    @Telastyn: It also works if it just returns null. You could also use an Option type. Commented Mar 16, 2017 at 19:31
  • @JacquesB: but what if null is a valid queueable item? Commented Apr 22, 2017 at 22:37