java find distinct values in array code example
Example 1: java get distinct values from list
List<String> distinctElements = list.stream()
.distinct()
.collect(Collectors.toList());
Example 2: java get unique elements from array
String[] unique = Arrays.stream(array).distinct().toArray(String[]::new);