String[] str1 = {"08:00", "09:00", "10:00", "18:00", "21:00"};
String[] str2 = {"12:00", "09:00", "10:00", "11:00"};
//jdk8 stream
str3 = Stream.concat(Stream.of(str1), Stream.of(str2)) //合并
.distinct() //去重
.sorted() //排序
.peek(System.out:println)
.toArray(String[]::new);```
两个数组合并去重
最新推荐文章于 2024-07-06 02:46:57 发布