Convert List of Characters to String in Java


Let’s say the following is our list of characters −

List<Character> list = Arrays.asList('W', 'e', 'l', 'c', 'o', 'm', 'e');

Convert the list of characters to string −

String string = list.stream().map(String::valueOf).collect(Collectors.joining());

Example

Following is the program to convert List of Characters to String in Java −

import java.util.stream.Collectors;
import java.util.Arrays;
import java.util.List;
public class Demo {
   public static void main(String[] args) {
      List<Character> list = Arrays.asList('W', 'e', 'l', 'c', 'o', 'm', 'e');
      String string = list.stream().map(String::valueOf).collect(Collectors.joining());
      System.out.println("String = "+string);
   }
}

Output

String = Welcome

Updated on: 04-Dec-2023

252 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements