mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-17 07:20:53 +07:00
9 lines
295 B
Java
9 lines
295 B
Java
import java.util.Collection;
|
|
import java.util.function.ToIntFunction;
|
|
import java.util.stream.Collectors;
|
|
|
|
class Test {
|
|
public static <T> int sum(Collection<? extends T> collection, ToIntFunction<? super T> mapper) {
|
|
return collection.stream().collect(Collectors.summingInt(mapper));
|
|
}
|
|
} |