Java String to List toList(String string)

Here you can find the source of toList(String string)

Description

Converts a string to a new, mutable list of Characters.

License

Open Source License

Parameter

Parameter Description
string The string to be converted.

Return

the list of characters.

Declaration

public static ArrayList<Character> toList(String string) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    /**/*from   w  ww. j  a  v  a2 s .co  m*/
     * Converts a string to a new, mutable list of Characters.
     * 
     * @param string The string to be converted.
     * @return the list of characters.
     */
    public static ArrayList<Character> toList(String string) {
        ArrayList<Character> list = new ArrayList<Character>(string.length());
        for (char c : string.toCharArray()) {
            list.add(c);
        }
        return list;
    }
}

Related

  1. toList(String s)
  2. toList(String s, String delim)
  3. toList(String s, String delimiter)
  4. toList(String str)
  5. toList(String str)
  6. toList(String text)
  7. toList(String transaction)
  8. toList(String val)
  9. toList(String val, String separator)