Java Utililty Methods Collection Split

List of utility methods to do Collection Split

Description

The list of methods to do Collection Split are organized into topic(s).

Method

voidsplitToCollection(Collection collection, String valueString)
split To Collection
String[] splitValues = valueString.split(",");
for (String value : splitValues) {
    value = value.trim();
    if (!value.isEmpty()) {
        collection.add(value);
CollectionsplitToCollection(String list, String separator, Collection dest)
Split the given String on a separator and add the (trimmed) results to a given Collection
String[] parts = list.split(separator);
for (String s : parts) {
    if (!s.equals("")) {
        dest.add(s.trim());
return dest;
voidsplitToCollection(String str, String sep, Collection c)
Add the trimmed elements of a String str seperated by some seperator sep to collection c
if (!str.equals("")) {
    for (String s : str.split(sep)) {
        c.add(s.trim());