Set<String> uniqueStudents = new HashSet<>();
for (List<String> listName: map.values()) {
uniqueStudents.add(listName.get(0));
}
System.out.println(uniqueStudents); // [John, Antony]
Set<String> uniqueStudents = new HashSet<>(map.values());
Set<String> set = map.values().stream()
.map(a -> a[0])
.collect(Collectors.toSet());