I want to convert ArrayList of Character to String. I read similar thread like Best way to convert an ArrayList to a string but I want simpler way.
I tried this
List<Character> chars = new ArrayList<Character>();
...
Character[] charArray = (Character[]) chars.toArray();
String output = new String(charArray); // error
But it didn’t work because the new String() constructor takes only char[] as parameter. I couldn’t convert chars or charArray to char[] type easily.
Aren’t there any simple way? Or, do I have to iterate to make a String?
This is about as simple as it gets: