L - type of the left sideR - type of the right sidepublic final class Pair<L,R> extends Object
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
L |
getLeft() |
R |
getRight() |
int |
hashCode() |
static <L,R> Pair<List<L>,List<R>> |
of(List<Either<L,R>> collection)
Given a list of Either[L,R] that can be a mixed collection of Left and Right, groups left side values into one list and
right side values into another list and return both lists together as a Pair (makes a union of the values contained within a
collection of disjoint unions)
|
static <K,U> Collector<Pair<K,U>,?,Map<K,U>> |
toMap()
|
Map.Entry<L,R> |
toMapEntry() |
public L getLeft()
public R getRight()
public static <L,R> Pair<List<L>,List<R>> of(List<Either<L,R>> collection)
L - type of the left sideR - type of the right sidecollection - a collection of disjoint unionspublic static <K,U> Collector<Pair<K,U>,?,Map<K,U>> toMap()
Stream of Pair-s to a Map using left value as the key and right
value as the value of the Map entries
Warning: this Collector will only work when the Stream does not contain duplicate left values in the Pair-s it contains.
K - kU - uCollectorCopyright © 2014–2015. All rights reserved.