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;
}