Back to project page mint.
The source code is released under:
GNU General Public License
If you think the Android project mint listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.gmail.altakey.mint.util; //from ww w . j a v a 2s .c o m import java.util.Arrays; import java.util.List; import java.util.Iterator; public class Joiner { private String mSeparator; private Joiner(String sep) { mSeparator = sep; } public static Joiner on(String sep) { return new Joiner(sep); } public String join(List<?> list) { StringBuilder builder = new StringBuilder(); Iterator<?> iter = list.iterator(); if (iter.hasNext()) { builder.append(toString(iter.next())); while (iter.hasNext()) { builder.append(mSeparator); builder.append(toString(iter.next())); } } return builder.toString(); } public String join(Object[] array) { return join(Arrays.asList(array)); } private String toString(Object o) { return o == null ? "" : o.toString(); } }