All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.katharsis.utils.StringUtils Maven / Gradle / Ivy

There is a newer version: 3.0.2
Show newest version
package io.katharsis.utils;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class StringUtils {

    public static String join(String delimiter, Iterable stringsIterable) {
        List strings = new LinkedList<>();
        Iterator iterator = stringsIterable.iterator();
        while (iterator.hasNext()) {
            strings.add(iterator.next());
        }

        StringBuilder ab = new StringBuilder();
        for (int i = 0; i < strings.size(); i++) {
            ab.append(strings.get(i));
            if (i != strings.size() - 1) {
                ab.append(delimiter);
            }
        }
        return ab.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy