Maybe this is very simple but I\'m actually a noob on Java 8 features and don\'t know how to accomplish this. I have this simple line that contains the following text:
String[]::new
is a function that invokes the new
"pseudo-method" for the String[]
type just like String::trim
is a function that invokes the real trim
method of the String type. The value passed to the String::new
function by toArray is the size of the collection on the right-hand side of the .toArray() method invocation.
If you replaced String[]::new
with n->new String[n]
you might be more comfortable with the syntax just like you could replace String::trim
with the less cool s->s.trim()