DATACMNS-1158 - Polishing.

Some code reorganization, polishing of nullable annotations, JavaDoc.

Original pull request: #243.
Related issue: DATAJPA-1173.
This commit is contained in:
Oliver Gierke
2017-11-24 10:53:47 +01:00
parent 300f3cfd66
commit 3c96e4e079
2 changed files with 27 additions and 14 deletions

View File

@@ -24,6 +24,7 @@ import lombok.ToString;
import java.util.Map;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* A tuple of things.
@@ -72,6 +73,11 @@ public final class Pair<S, T> {
return second;
}
/**
* A collector to create a {@link Map} from a {@link Stream} of {@link Pair}s.
*
* @return
*/
public static <S, T> Collector<Pair<S, T>, ?, Map<S, T>> toMap() {
return Collectors.toMap(Pair::getFirst, Pair::getSecond);
}