Java ArrayList to String toString(ArrayList characters)

Here you can find the source of toString(ArrayList characters)

Description

to String

License

Apache License

Declaration

public static String toString(ArrayList<Character> characters) 

Method Source Code

//package com.java2s;
/**// w w  w  . j ava 2  s. c om
 * HashMap?????????????????????????new??????????????????????????
 * ????????
 * code by guava-libraries.(Apache License 2.0)
 * https://code.google.com/p/guava-libraries/
 *
 * @return HashMap????????????????????????
 */

import java.util.ArrayList;

public class Main {

    public static String toString(ArrayList<Character> characters) {
        Character[] array = characters.toArray(new Character[0]);
        char[] chars = new char[array.length];
        for (int i = 0; i < array.length; i++) {
            chars[i] = array[i];
        }
        String result = new String(chars);
        return result;
    }

    public static String toString(char c) {
        return String.valueOf(c);
    }

    public static String toString(int value) {
        return value + "";

        // return String.valueOf(value);
    }
}

Related

  1. toString(ArrayList a, String delim)
  2. ToString(ArrayList list)
  3. toString(ArrayList arrayList)
  4. vectorToStr(ArrayList vtr)