There was an error while loading. Please reload this page.
Checks that algorithms consider not only call-expressions, but refereces (like ClassA::methodA1) too.
package referencesOnly; public class ClassA { static Object doSomething1(Object o) { return "result"; } static Object doSomething2(Object o) { return "result"; } }
package referencesOnly; import java.util.ArrayList; import java.util.List; import java.util.function.Function; import java.util.stream.Collectors; public class ClassB { public void mainF() { List<Object> list = new ArrayList<>().stream() .map(ClassA::doSomething1) .map(ClassA::doSomething1) .map(ClassA::doSomething1) .map(ClassA::doSomething1) .collect(Collectors.toList()); Function<Object, Object> myFunction = ClassA::doSomething2; myFunction = ClassA::doSomething2; myFunction = ClassA::doSomething2; myFunction = ClassA::doSomething2; } static void foo() {} }