Meaning of :: in Java syntax -
this question has answer here:
- :: (double colon) operator in java 8 13 answers
what meaning of :: in following code?
set<string> set = people.stream() .map(person::getname) .collect(collectors.tocollection(treeset::new));
this method reference. added in java 8.
treeset::new
refers default constructor of treeset
.
in general a::b
refers method b
in class a
.
Comments
Post a Comment