//对字符串数字排序 Stream.of("123", "321", "132","312").sorted(Comparator.comparingInt(Integer::parseInt)) // 对Object属性排序 Stream.of( new Exception("13"), new Exception("1"), new Exception("21"), new Exception("3") ).sorted(Comparator.comparing(Exception::getMessage, Comparator.comparingInt(Integer::parseInt)));