Initializing a Java Array in One Line

Initialization of an ArrayList in one line example

Good post from Memory Not Found on how to initialize an Array in one line. Some examples follow. Go to the post for 7 examples total.

List<String> planets = Arrays.asList("Earth", "Mars", "Venus");
List<String> planets = asList("Earth", "Mars", "Venus");
List<String> planets = Stream
        .of("Earth", "Mars", "Venus")
        .collect(Collectors.toList());