I'm confused about concept behind "Reference to an Instance Method of an Arbitrary Object of a Particular Type". Oracle documentation has an example about this:
String[] stringArray = { "Barbara", "James", "Mary", "John", "Patricia", "Robert", "Michael", "Linda" };
Arrays.sort(stringArray, String::compareToIgnoreCase);
Most of the examples I have seen for this kind of method reference is like this: If lambda is like: x -> x.func() then you can write it like ClassOfX::func. The example in documentation says:
The equivalent lambda expression for the method reference String::compareToIgnoreCase would have the formal parameter list (String a, String b), where a and b are arbitrary names used to better describe this example. The method reference would invoke the method a.compareToIgnoreCase(b).
The question is: for any two argument lambda like (a, b) -> a.func(b) the func method must be instance method of first argument and second argument of lambda will be passed as an argument to that method? If we have multiple argument lambda then func method must be instance method of first argument of lambda and other arguments of lambda will be passed to func in the order the appear in lambda? I mean instead of (a, b, c) -> a.func(b, c) we can write ClassOfA::func
I'm sorry for my English. I hope I made the problem clear.
