Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
4.x, 3.0.3
-
None
Description
Proposal to add a new extension method for Stream that returns a typed array with minimal boilerplate (i.e. is somewhere in between toArray() and toArray(IntFunction):
void test(List<String> list) { def array = list.stream().toArray() // returns Object[] array = list.stream().toArray(String) // returns String[] -- proposed extension array = list.stream().toArray(String[]::new) // returns String[] but requires "[]::new" }