Answers for "java convert string to arraylist of chars"

1

convert every character in string to arraylist jva

import java.util.ArrayList;
import java.util.List;

// Convert a String to a List of Characters
class Util
{
	public static void main(String[] args)
	{
		String string = "Techie Delight";
		List<Character> chars = new ArrayList<>();

		for (char ch: string.toCharArray()) {
			chars.add(ch);
		}

		System.out.println(chars);
	}
}
Posted by: Guest on March-13-2020
0

Arraylist string to character java

String str = "abcd...";
ArrayList<Character> chars = new ArrayList<Character>();
for (char c : str.toCharArray()) {
  chars.add(c);
}
Posted by: Guest on December-23-2020

Code answers related to "java convert string to arraylist of chars"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language