|
|
@@ -1,11 +1,10 @@
|
|
1
|
1
|
import java.util.ArrayList;
|
|
2
|
|
-import java.util.Collection;
|
|
3
|
2
|
import java.util.List;
|
|
4
|
3
|
import java.util.function.Function;
|
|
5
|
4
|
|
|
6
|
5
|
public class Accumulate {
|
|
7
|
6
|
|
|
8
|
|
- public static <T> Collection<T> accumulate(Collection<T> collection, Function<T, T> function) {
|
|
|
7
|
+ public static <T> List<T> accumulate(List<T> collection, Function<T, T> function) {
|
|
9
|
8
|
List<T> newCollection = new ArrayList<>();
|
|
10
|
9
|
|
|
11
|
10
|
for (T item : collection) {
|