1import java.util.ArrayList;
2import java.util.List;
3
4// Convert a String to a List of Characters
5class Util
6{
7 public static void main(String[] args)
8 {
9 String string = "Techie Delight";
10 List<Character> chars = new ArrayList<>();
11
12 for (char ch: string.toCharArray()) {
13 chars.add(ch);
14 }
15
16 System.out.println(chars);
17 }
18}
1public char[] toArray(List<Character> list){
2 char[] toReturn = new char[list.size()];
3 int i = 0;
4 for(char c : list)
5 toReturn[i ++] = c;
6 return toReturn;
7}
8