Here you can find the source of toString(ArrayList
public static String toString(ArrayList<Character> characters)
//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); } }