MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / fill

Method fill

collectiontopics/TypesForSets.java:40–46  ·  view source on GitHub ↗
(Set<T> set, Function<Integer, T> type)

Source from the content-addressed store, hash-verified

38
39public 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);

Callers 1

testMethod · 0.95

Calls 2

applyMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected