Method References
?
Introduced in Java 8
"`::" is short hand for calling methods in functional programming.
It used to be
myList.stream().anyMatch(u -> User.isRealUser(u))
For a static method
myList.stream().anyMatch(User\:\:isAdmin)
For an instance method
myList.stream().anyMatch(user\:\:isAdmin)
For an object method
long numEmpty = myStringList.stream().filter(String\:\:isEmpty).count()
For a constructor
Stream<User> myEmptyObjects = array.stream().map(User::new);
<!--SR:!2025-11-19,1,190-->