Stream

Stream filter(Predicate predicate);
 Stream map(Function mapper);
T reduce(T identity, BinaryOperator accumulator);
 R collect(Collector collector);

FunctionalInterface

public interface Function {
    R apply(T t);
}
public interface BiFunction {
    R apply(T t, U u);
}
public interface BinaryOperator extends BiFunction {

}
public interface Supplier {
    T get();
}
public interface Consumer {
    void accept(T t);
}
public interface BiConsumer {
    void accept(T t, U u);
}
public interface Predicate {
    boolean test(T t);
}
public interface BiPredicate {
    boolean test(T t, U u);
}

Collector

static class CollectorImpl implements Collector {
    private final Supplier supplier;
    private final BiConsumer accumulator;
    private final BinaryOperator combiner;
    private final Function finisher;
    private final Set characteristics;

    CollectorImpl(Supplier supplier,
        BiConsumer accumulator,
        BinaryOperator combiner,
        Function finisher,
        Set characteristics) {
        this.supplier = supplier;
        this.accumulator = accumulator;
        this.combiner = combiner;
        this.finisher = finisher;
        this.characteristics = characteristics;
    }

    CollectorImpl(Supplier supplier,
        BiConsumer accumulator,
        BinaryOperator combiner,
        Set characteristics) {
        this(supplier, accumulator, combiner, castingIdentity(), characteristics);
    }

    @Override
    public BiConsumer accumulator() {
      return accumulator;
    }

    @Override
    public Supplier supplier() {
        return supplier;
    }

    @Override
    public BinaryOperator combiner() {
        return combiner;
    }

    @Override
    public Function finisher() {
        return finisher;
    }

    @Override
    public Set characteristics() {
        return characteristics;
    }
}