Multiple return types

Today I had this little problem: I have JMS messages with common properties, and some properties set depending on message type. I want to handle all the common properties in a specific method so I don’t need to duplicate code. How can I return different types from the same method!? Is this even possible in […]

Streaming Optional

The amazing Optional class in Java can sometimes be a bit frustrating; what if you have a bunch of them and want a nice and tidy Stream to do some work? If the “bunch” is a List or similar, then no problem. But what if not?