Sure /s.
But seriously I dislike the notion that FP is somehow a successor to OOP, like you have to keep piling abstractions onto OOP until it becomes FP!
If you do it that way, you end up with map() implementations like:
public final <R> Stream<R> map(final Function<? super P_OUT, ? extends R> mapper) {
Objects.requireNonNull(mapper);
return new StatelessOp<P_OUT, R>(this, StreamShape.REFERENCE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
Sink<P_OUT> opWrapSink(int flags, Sink<R> sink) {
return new Sink.ChainedReference<P_OUT, R>(sink) {
public void accept(P_OUT u) {
this.downstream.accept(mapper.apply(u));
}
};
}
};
}
Ain't nobody got time to read that. Step back from OOP before putting in the FP and you can get map() looking like: map _ [] = []
map f (x:xs) = f x : map f xs