Converting a string into an List [closed]

Since this is a JSON representation of an array, you can use any JSON api.

For instance using Jackson:

String s = "[1,2,3]";
long[] a = new ObjectMapper().reader(long[].class).readValue(s);
List<Long> l = new ObjectMapper().reader(List.class).readValue(s);

Leave a Comment