Answers for "java string to char arraylist"

4

arraylist of characters

import java.util.ArrayList;

  public class Test{

       String words = new String("HELLO GOODBYE!");
       ArrayList<Character> sample = new ArrayList<Character>();

       for(int i = 0; i<words.length(); i++){
           sample.add(words.charAt(i));
       }
  }
Posted by: Guest on August-20-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
0

char array to arraylist java

myString.chars().mapToObj(c -> (char) c).collect(Collectors.toList());
Posted by: Guest on May-07-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language