MCPcopy Create free account
hub / github.com/apache/groovy / inits

Method inits

src/main/java/groovy/util/GroovyCollections.java:97–105  ·  view source on GitHub ↗

@since 2.5.0

(Iterable<T> collections)

Source from the content-addressed store, hash-verified

95 * @since 2.5.0
96 */
97 public static <T> List<List<T>> inits(Iterable<T> collections) {
98 List<T> copy = DefaultGroovyMethods.toList(collections);
99 List<List<T>> result = new ArrayList<>();
100 for (int i = copy.size(); i >= 0; i--) {
101 List<T> next = copy.subList(0, i);
102 result.add(next);
103 }
104 return result;
105 }
106
107 /**
108 * @since 2.5.0

Callers 1

initsMethod · 0.95

Calls 4

toListMethod · 0.95
sizeMethod · 0.65
addMethod · 0.65
subListMethod · 0.45

Tested by

no test coverage detected