list.sort((String s1, String s2) -> s1.compareTo(s2));
list.sort(( LibraryDO lib1, LibraryDO lib2) -> lib2.getId().compareTo(lib2.getId()));
Collections.sort(list, Comparator.comparing(LibraryDO::getId));
Collections.reverse(list);
Collections.shuffle(list);
List<LibraryDO> collect = users.stream().sorted(Comparator.comparing(LibraryDO::getId)).collect(Collectors.toList());
List<LibraryDO> collect = users.stream().sorted(Comparator.comparing(LibraryDO::getId).reversed()).collect(Collectors.toList());
List<String> collect = list.stream().distinct().collect(Collectors.toList());
String joining = list.stream().distinct().collect(Collectors.joining(","));
List<LibraryDO> lib = list.stream().collect(Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(LibraryDO::getId))), ArrayList<LibraryDO>::new));
List<String> collect= list.stream().map(LibraryDO::getId).collect(Collectors.toList());
Integer[] array = list.stream().map(LibraryDO::getId).collect(Collectors.toList()).stream().toArray(Integer[]::new);
Integer[] array = list.stream().map(LibraryDO::getId).filter(x -> x !=null).collect(Collectors.toList()).stream().toArray(Integer[]::new);
List<LibraryDO> lib = list.stream().map(p -> {p.setId(p.getId() + 1);return p;}).collect(Collectors.toList())
public class LibraryDO implements Serializable {
private Integer id;
private String libName;
private String libUrl;
}
排序
https://www.cnblogs.com/woyaobianfei/p/9187127.htm