I am using springboot with gradle and I am trying to execute below code in the controller.
List<String> planets
= List.of("Mercury", "Venus", "Earth", "Mars",
"Jupiter", "Saturn", "Uranus", "Neptune");
On compiling I get the following error
error: cannot find symbol = List.of("Mercury", "Venus", "Earth", "Mars", ^ symbol: method of(String,String,String,String,String,String,String,String)
location: interface List
my gradle file has
sourceCompatibility = '1.8'
I do understand that its a java 9 feature but unsure why would it fail on compile