You can use String.join()
List<String> names = Arrays.asList(new String[] {"Abe", "Barb", "Chris", "Dawn"});
System.out.println(String.join(", ", names));
This prints:
Abe, Barb, Chris, Dawn
You can use String.join()
This prints:
Abe, Barb, Chris, Dawn
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.