void (String[] args) { List<String> l = Arrays.asList("America", "Britain", "Australia", "Brazil", "Canada"); System.out.println(l); System.out.println(uniquifyListByProperty(l, Function.identity())); System.out.println(uniquifyListByProperty(l, s -> s.charAt(0))); }