Java Collection Join join(String glue, Collection c)

Here you can find the source of join(String glue, Collection c)

Description

join

License

Open Source License

Declaration

public static String join(String glue, Collection<? extends Object> c) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static String join(String glue, Collection<? extends Object> c) {
        StringBuilder buf = new StringBuilder();
        for (Object o : c) {
            if (buf.length() > 0) {
                buf.append(glue);/*from w w w.  ja  v a2 s. c o m*/
            }
            buf.append(o.toString());
        }
        return buf.toString();
    }
}

Related

  1. join(String delimiter, Collection stringCollection)
  2. join(String delimiter, Collection strings)
  3. join(String delimiter, Collection values)
  4. join(String glue, Collection c)
  5. join(String glue, Collection pieces)
  6. join(String glue, Collection strings)
  7. join(String glue, Collection items)
  8. join(String join_string, Collection c)
  9. join(String joiner, Collection strings)