Guest User

Untitled

a guest
Nov 20th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. List<Unit> yards = new ArrayList<>(unitsApi.getAllUnits());
  2.  
  3. Collections.sort(yards, new BeanComparator<Unit>("name"));
  4.  
  5. //another try
  6. List<Unit> sortedNames = yards.stream().sorted().collect(Collectors.toList());
  7.  
  8. //num3 another
  9. //List<Unit> sortedList = yards
  10. .stream().sorted(Comparator.comparing(Object::toString))
  11. .collect(Collectors.toList());
  12.  
  13. model.addAttribute("yards", sortedList);
Add Comment
Please, Sign In to add comment