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

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -