4

I can see from java8 docs that ::new is used to refer to the constructor method.

But when it comes to this statement,

stream.toArray(String[]::new) 

what does String[]::new mean? There shouldn't be a class named String[] which is very lame and I could not interpret what it is actually meant for.

Naman
  • 27,789
  • 26
  • 218
  • 353

0 Answers0