Android Collection Join write(Collection c, Object separator, Object prefix, Object postfix)

Here you can find the source of write(Collection c, Object separator, Object prefix, Object postfix)

Description

write

Declaration

public static String write(Collection<?> c, Object separator,
            Object prefix, Object postfix) 

Method Source Code

//package com.java2s;

import java.util.Collection;

public class Main {
    public static String write(Collection<?> c, Object separator,
            Object prefix, Object postfix) {
        StringBuilder sb = new StringBuilder();
        boolean first = true;
        for (Object o : c) {
            if (!first)
                sb.append(separator);//from   w  w  w .  jav a2 s . c  o m
            sb.append(prefix).append(o).append(postfix);
            first = false;
        }
        return sb.toString();
    }
}

Related

  1. join(final Collection strings, String delimeter)
  2. join(Collection collection, String delimiter)
  3. join(Collection s, String delimiter)
  4. join(CharSequence separator, Collection values)
  5. join(Collection strings, String sep)