Answers for "java String.join arraylist"

1

java string join arraylist

// You can't just do String.join(", ", list) because
// the list has to be a String[]. This code works on
// everything.

list.stream().map(Object::toString).collect(Collectors.joining(", "));
Posted by: Guest on June-21-2021
1

java join list as string

List<String> list = Arrays.asList("a","b","c");
String result = String.join(",", list);

System.out.println(result);		//prints a,b,c
Posted by: Guest on August-14-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language