java - How to pass parameter in Stream.map method -


what below statement mean:

string joined = elements.stream()   .map(object::tostring)   .collect(collectors.joining(", ")); 

as understand, stream.map accepts parameter of type function. don't understand how object::tostring being passed , how works?

thanks.

how object::tostring being passed , how works?

it called method reference in telling use existing tostring method definition (from object class) map method, rather explicitly calling obj -> obj.tostring() inside map method.

i suggest @ here , understand on how method references work in java8.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -