I am working on this project currently. It works surprisingly well.
Yet, after re-reading the README again, I started to wonder about how to document something that is bugging me...
To quote the example, and forgetting for a moment that exceptions can be thrown, it reads:
Files.list(somePath).map(Path::toRealPath).forEach(System.out::println)
OK. Now, the method of Path
involved is this one. Of course, we do not pass any LinkOption
.
Again: let's forget for a moment that it throws any exception.
Stream's .map()
takes a Function
as an argument. This interface, for Function<T, R>
, is defined as:
R apply(T t);
But the method I am using accepts no arguments. At a first glance, it does not seem to match a Function
, right? Except that...
It can be written as:
path -> path.toRealPath()
It therefore looks like the mechanism used is somewhat able to invoke a method on the "stream object" if the method reference has no argument, or something like that...
I'd like to document this accordingly, and I am missing something here.
What am I missing?