Is there a way to use doubleColon to invoke second level method.
Example ClassA::getClassBObject::classBMethod in lambda invocation
What you are expecting is called chaining. Method references does not support chaining.
Read more about Method References.
You could compose the functions:
((Function<ClassA, ClassB>) ClassA::getClassBObject).andThen(ClassB::classBMethod)
But you're probably better off with just (x, arg) -> x.getClassBObject().classBMethod(arg).
More info on the composition approach: https://stackoverflow.com/a/32838924/2093695
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With