List<Object> al = Arrays.asList("ABC", "XYZ");
This code works fine in Java11 but when I try this in Java12, it gives an error Cannot cast from List to ArrayList
Any hint what I am missing?
Thanks for the help.
List<Object> al = Arrays.asList("ABC", "XYZ");
This code works fine in Java11 but when I try this in Java12, it gives an error Cannot cast from List to ArrayList
Any hint what I am missing?
Thanks for the help.
First, we need to check whether the value of setValues is a list or nested list
ValueRange body=new ValueRange().setValues(Arrays.asList(Arrays.asList("ABC", "XYZ"))); the above will give the results [[ABC, XYZ]] -> Nested array
Instead, try like this
ValueRange body=new ValueRange().setValues(new ArrayList<>(Arrays.asList("ABC", "XYZ")));
This gives results - > [ABC, XYZ]