Advertisement
mirozspace

question111

Mar 18th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class test1111111 {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6. Map<String, List<String>> cars = new LinkedHashMap<>();
  7.  
  8. cars.putIfAbsent("asen", new ArrayList<>());
  9. List<String> carsList = cars.get("asen");
  10.  
  11. carsList.add("wv");
  12. carsList.add("bmw");
  13. carsList.add("opel");
  14.  
  15. cars
  16. .entrySet()
  17. .stream()
  18. //.sorted((x, y) -> Integer.compare(y.getValue().size(), x.getValue().size()))
  19. //.sorted((x, y) -> )
  20. .forEach(k -> {
  21. System.out.print(String.format("%s: ", k.getKey()));
  22. k.getValue().forEach(marka -> System.out.print(" " + marka));
  23. });
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement