how to convert a stream to an array code example Example: collect as arr java 8 String[] myNewArray3 = myNewStream.toArray(String[]::new);