Is there any built-in method in Java which allows us to convert comma separated String to some container (e.g array, List or Vector)? Or do I need to write custom code for t
An example using Collections.
Collections
import java.util.Collections; ... String commaSeparated = "item1 , item2 , item3"; ArrayList items = new ArrayList<>(); Collections.addAll(items, commaSeparated.split("\\s*,\\s*")); ...