interface Stream { void forEach(Consumer consumer); } interface List { Stream stream(); } interface Consumer { public void accept(T t); } interface BiFunction { R apply(T t, U u); } interface BiConsumer { void accept(T t, U u); } class Test { public static void zipConsume(Stream a, Stream b, BiConsumer zipper) { zip(a, b, Pair::new).forEach(p -> zipper.accept(p.a, p.b)); } public static Stream zip(Stream a, Stream b, BiFunction zipper) { return null; } private static class Pair { private final A a; private final B b; protected Pair(A a, B b) { this.a = a; this.b = b; } } void foo(List a, List b) { zipConsume(a.stream(), b.stream(), (x, y) -> System.out.println(x + y)); } }