Java Collection Join join(String delimiter, Collection a)

Here you can find the source of join(String delimiter, Collection a)

Description

join

License

Apache License

Declaration

public static String join(String delimiter, Collection<?> a) 

Method Source Code


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

import java.util.*;

public class Main {
    public static String join(String delimiter, Collection<?> a) {
        if (a.isEmpty()) {
            return "";
        }/*from   w  w  w.  jav a  2s . c o  m*/
        StringBuilder buffer = new StringBuilder();
        for (Object o : a) {
            buffer.append(delimiter);
            buffer.append(o);
        }
        return buffer.substring(delimiter.length());
    }
}

Related

  1. join(String delim, Collection collections)
  2. join(String delim, Collection values)
  3. join(String delimeter, Collection items)
  4. join(String delimiter, Collection objects)
  5. join(String delimiter, Collection objects)
  6. join(String delimiter, Collection items)
  7. join(String delimiter, Collection objects)
  8. join(String delimiter, Collection parts)
  9. join(String delimiter, Collection items)