2022-03-23から1日間の記事一覧

list chain execute

public static <T, R> R relayFunction(List<T> list, Function<T, R> first, BiFunction<T, R, R> func){ Iterator<T> it = list.iterator(); R r = it.hasNext() ? first.apply(it.next()) : null; while(it.hasNext()) { r = func.apply(it.next(), r); } return r; }</t></t,></t,></t></t,>