Java Collection Concatenate concat(String separator, Collection args)

Here you can find the source of concat(String separator, Collection args)

Description

concat

License

Apache License

Declaration

public static String concat(String separator, Collection args) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

public class Main {
    public static String concat(String separator, Collection args) {
        StringBuilder sb = new StringBuilder();
        for (Object arg : args) {
            sb.append(separator).append(arg);
        }//www .  java  2  s  .  c  o  m

        if (sb.length() > 0) {
            sb.delete(0, separator.length());
        }

        return sb.toString();
    }
}

Related

  1. concat(Collection a, int offset, String sep, String start, String end)
  2. concat(Collection first, Collection second)
  3. concat(Collection... collections)
  4. concat(final Collection... collections)
  5. concat(final Collection... collections)
  6. concat(String[] first, Collection second)
  7. concatCollection(Collection collection)
  8. concatElements(final Collection c, final String separator)
  9. concatenate(Collection collections)