Skip to content

Add a way to create a Pair with an already created Optional<> #1228

@ndolhii

Description

@ndolhii

Spine allows having an Optional as the second argument of Pair but the only way to create it is call Pair.withNullable() which allows the second argument to be null, but there is no option to create a Pair if I have a message that is already wrapped in Optional.

I see the method signature like this:

public static  <M extends Message, O extends Optional<? extends Message>> Pair<M, O> withOptional(M a, O b)

The resulting API will be:

Optional<Message> optional = Optional.of(...);

Pair<Message, Optional<Message>> = Pair.withOptional(message, optional);

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions