Guest User

Untitled

a guest
Feb 18th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. final Map<String, String> output =
  2. input.entrySet()
  3. .stream()
  4. .collect(Collectors.toMap(
  5. o -> o.getKey(),
  6. o -> o.getValue().getName()
  7. ));
  8.  
  9. Map<Integer, User> users = new HashMap<>();
  10.  
  11. users.put(1, new User());
  12.  
  13. Map<Integer, String> userIdToUserName = users.entrySet().stream()
  14. .collect(Collectors.toMap(Map.Entry::getKey, v -> v.getValue().getName()));
Add Comment
Please, Sign In to add comment