I want to translate a List of objects into a Map using Java 8\'s streams and lambdas.
This is how I would write it in Java 7 and below.
private Map&l
Another possibility only present in comments yet:
Map result = choices.stream().collect(Collectors.toMap(c -> c.getName(), c -> c)));
Useful if you want to use a parameter of a sub-object as Key:
Map result = choices.stream().collect(Collectors.toMap(c -> c.getUser().getName(), c -> c)));