I have a map which has pair values
Map<String, Pair<Request, Request>> myRequest;
I would like to create a set only fetching the first value from the pair. Is there way to use Java streams to do this?
CodePudding user response:
Not sure what the definition of Pair
is but something like
myRequest.values()
.stream()
.map(it -> it.getFirst())
.collect(Collectors.toSet())