Java Utililty Methods Collection Join

List of utility methods to do Collection Join

Description

The list of methods to do Collection Join are organized into topic(s).

Method

StringgetNeoString(String columnName, String delimiter, Collection input, String join)
get Neo String
String result = "";
for (String field : input) {
    if (field != null) {
        if (field.equals("User"))
            field = "_FortressUser";
        if (requiresQuoting(field))
            field = "`" + field + "`";
        if (result.equals(delimiter) || result.equals(""))
...
Stringimplode(Collection items, String join)
implode
String result = "";
int i = 0;
for (String s : items) {
    result += s;
    if (i < items.size() - 1) {
        result += join;
    i++;
...
StringinternalJoin(String sep, Collection pieces)
internal Join
StringBuilder sb = new StringBuilder();
boolean skipSep = true;
Iterator<Object> iter = pieces.iterator();
while (iter.hasNext()) {
    if (skipSep) {
        skipSep = false;
    } else {
        sb.append(sep);
...
booleanisDisjoint(Collection a, Collection b)
Returns true if Collections are disjoint each other.
if (a == null || b == null)
    return true;
Collection<?> tester = (a.size() < b.size()) ? a : b;
Collection<?> testant = (a.size() < b.size()) ? b : a;
for (Object o : tester) {
    if (testant.contains(o))
        return false;
return true;
Stringjoin(AbstractCollection s, String delimiter)
Join a Collection of Strings using a delimiter
if (s == null || s.isEmpty()) {
    return "";
Iterator<String> iter = s.iterator();
StringBuilder builder = new StringBuilder(iter.next());
while (iter.hasNext()) {
    builder.append(delimiter).append(iter.next());
return builder.toString();
Stringjoin(CharSequence p, Collection collection)
join
StringBuilder sb = new StringBuilder();
boolean f = true;
for (Object c : collection) {
    if (f)
        f = false;
    else
        sb.append(p);
    sb.append(c.toString());
...
StringBuilderjoin(CharSequence separator, Collection col)
join
final StringBuilder result = new StringBuilder();
if (col != null) {
    for (Iterator<?> it = col.iterator(); it.hasNext();) {
        result.append(it.next());
        if (it.hasNext()) {
            result.append(separator);
return result;
Stringjoin(Collection c)
join
return join(c, ", ");
Stringjoin(Collection c, String d)
join
String result = "";
boolean isFirst = true;
for (Object o : c) {
    result += (isFirst ? "" : d) + o.toString();
    isFirst = false;
return result;
Stringjoin(Collection c, String delim)
join
if (c == null || c.isEmpty())
    return "";
else if (c.size() == 1)
    return String.valueOf(c.iterator().next());
StringBuffer result = new StringBuffer();
for (Iterator i = c.iterator(); i.hasNext();)
    result.append(delim).append(i.next());
return result.substring(delim.length());
...