【发布时间】:2011-06-13 02:25:47
【问题描述】:
有没有这样的库:
public class Iterables{
private Iterables() {}
public static <T> int sum(Iterable<T> iterable, Func<T, Integer> func) {
int result = 0;
for (T item : iterable)
result += func.run(item);
return result;
}
}
public interface Func<TInput, TOutput> {
TOutput run(TInput input);
}
【问题讨论】:
标签: java