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

org.tomitribe.auth.signatures.Join Maven / Gradle / Ivy

There is a newer version: 1.7.0
Show newest version
package org.tomitribe.auth.signatures;

import java.util.Collection;

public enum Join {
    ;

    public static String join(final String delimiter, final Collection collection) {
        if (collection.size() == 0) return "";

        final StringBuilder sb = new StringBuilder();

        for (final Object obj : collection) {
            sb.append(obj).append(delimiter);
        }

        return sb.substring(0, sb.length() - delimiter.length());
    }

    public static String join(final String delimiter, final Object... collection) {
        if (collection.length == 0) return "";

        final StringBuilder sb = new StringBuilder();

        for (final Object obj : collection) {
            sb.append(obj).append(delimiter);
        }

        return sb.substring(0, sb.length() - delimiter.length());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy