import java.util.List;import java.util.stream.Stream;
class Main {
public static void main(String[] args) {// Create a stream of strings from list of stringsStream<String> myStreamOfStrings = List.of("lala", "foo", "bar").stream();
// Convert stream to array by using toArray methodString[] myArrayOfStrings = myStreamOfStrings.toArray(String[]::new);
// Print resultsfor (String string : myArrayOfStrings) {System.out.println(string);}}}