Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

java sort arraylist of objects by field descending

List<User> sortedUsers = users.stream()
  .sorted(Comparator.comparing(User::getCreatedOn).reversed())
  .collect(Collectors.toList());
Source by www.codebyamir.com #
 
PREVIOUS NEXT
Tagged: #java #sort #arraylist #objects #field #descending
ADD COMMENT
Topic
Name
6+8 =