Tagged: #string

Java – Convert List to comma-separated String

This tutorial shows several ways for converting a List to a comma-separated String in Java. 1- Java 7 The traditional way of converting a List to a comma-separated String in Java 7 and older versions is through using StringBuilder as the following:

2- Java 8 In Java 8, there are 2 conversion ways. 2.1. String.join() The most common way is...

Java – Convert comma-separated String to List

This tutorial shows several ways for converting a comma-separated String to a List in Java. 1- Java 7 With Java 7 and older versions, the typical way of converting a comma-separated String to a List is through splitting the String by the comma “,” delimiter and then generating a List using Arrays.asList() as the following:

2- Java 8 In...