How to convert a String without separator to an ArrayList
.
My String is like this:
String str = \"abcd...\"
Sorry for the Retrobump, but this is now really easy!
You can do this easily in Java 8 using Streams! Try this:
String string = "testingString";
List list = string.chars().mapToObj((i) -> Character.valueOf((char)i)).collect(Collectors.toList());
System.out.println(list);
You need to use mapToObj
because chars()
returns an IntStream
.