I have some misunderstanding about Java 8 static method references.
The following is a correct statement:
Stream.of("aaa", "bbb", "cccc").map(String::length);
AFAIK map requires a Function<T, R> interface as an argument with method similar to:
R apply(T t);
However, the length() method of String class doesn't accept any arguments:
public int length() {
return value.length;
}
1) How does it correlate with apply method which needs an argument T t?
2) If I write String::someMethod doesn't it mean that someMethod should be static (since I'm calling it by class name, not by an object reference)?
Thank you!