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