Android Collection Join join(Collection collection, String s)

Here you can find the source of join(Collection collection, String s)

Description

join

Declaration

public static String join(Collection collection, String s) 

Method Source Code

//package com.java2s;

import java.util.*;

public class Main {
    public static String join(Collection collection, String s) {
        String s1;/*from   ww w  .j a  va 2s.c o m*/
        if (collection.size() == 0) {
            s1 = "";
        } else {
            StringBuilder stringbuilder = new StringBuilder();
            for (Iterator iterator = collection.iterator(); iterator
                    .hasNext();) {
                String s2 = (String) iterator.next();
                StringBuilder stringbuilder1 = stringbuilder.append(s2)
                        .append(s);
            }

            if (stringbuilder.length() > 0) {
                int i = stringbuilder.length() - 1;
                int j = stringbuilder.length();
                StringBuilder stringbuilder2 = stringbuilder.delete(i, j);
            }
            s1 = stringbuilder.toString();
        }
        return s1;
    }
}

Related

  1. join(Collection... collections)
  2. join(String conjunction, Collection... collections)
  3. suffixAndJoin(String suffix, String delimiter, Collection values)
  4. toString(Collection collection, String separator)
  5. join(Collection strings, String sep)
  6. join(Collection strings, String sep)
  7. join(final Collection strings, String delimeter)
  8. join(Collection collection, String delimiter)