(Set<T> set, Function<Integer, T> type)
| 45 | set.add(type.apply(i)); |
| 46 | } |
| 47 | static <T> void |
| 48 | test(Set<T> set, Function<Integer, T> type) { |
| 49 | fill(set, type); |
| 50 | fill(set, type); // Try to add duplicates |
| 51 | fill(set, type); |
| 52 | System.out.println(set); |
| 53 | } |
| 54 | public static void main(String[] args) { |
| 55 | test(new HashSet<>(), HashType::new); |
| 56 | test(new LinkedHashSet<>(), HashType::new); |