That's all about the double colon operator of Java 8. If you want to learn more, then these Java collections and Stream courses are the best places to start with. Remember, there is no parenthesis when you refer to a method using method reference or lambda expression in Java 8. The idea is that if you are passing a lambda expression, like a function that takes a value and prints in the console then instead of giving lambda expression, just pass the println() method of PrintStream class which you can access as a System.out::println. An array constructor reference (TypeName::new) like String::new.A class constructor reference (ClassName::new) like ArrayList::new.An instance method of an arbitrary object of a particular type ( ClassName::methodName).A super method of a particular object ( super::methodName).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |