Allow returning Optional<Tuple> from @React handlers
Currently, from event reactor method we can return:
-
EventMessage -
Optional<EventMessage> -
Iterable<EventMessage> -
EitherOf<...>
But, to express that we want to return a pair (or triplet, or ...) of events or nothing we have now the following options:
-
Triplet<EventMessage,EventMessage,Nothing> -
Iterable<EventMessage>where iterable is empty when no events are emitted
The best way to express this, from my standpoint, is to have an Optional<Pair<EventMessage, EventMessage>> that is not supported by the framework now.
Triplet<EventMessage,EventMessage,Nothing>
This does not make much sense. It's a Pair. But your request does make sense. How often do you need such a thing?
Depending on the answer, we'd schedule this.
Yep, the Triplet<EventMessage,EventMessage,Nothing> is ugly. We've got 3 places in the BKO where we use ImmutableList as a return type with just returning an empty list when smth is optional. We also have a similar approach being used in the Backlog. I believe we'll similar usages in other projects as well.