(Set<T> set, Function<Integer, T> type)
| 38 | |
| 39 | public class TypesForSets { |
| 40 | static <T> void |
| 41 | fill(Set<T> set, Function<Integer, T> type) { |
| 42 | for(int i = 10; i >= 5; i--) // Descending |
| 43 | set.add(type.apply(i)); |
| 44 | for(int i = 0; i < 5; i++) // Ascending |
| 45 | set.add(type.apply(i)); |
| 46 | } |
| 47 | static <T> void |
| 48 | test(Set<T> set, Function<Integer, T> type) { |
| 49 | fill(set, type); |