String[] someArr =new String[]{"a","b","c","a"}; //去重 someArr=Arrays.stream(someArr).distinct().toArray(String[]::new); Arrays.stream(someArr).forEach(System.out::println);