List of utility methods to do Collection Join
String | getNeoString(String columnName, String delimiter, Collection 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("")) ... |
String | implode(Collection implode String result = ""; int i = 0; for (String s : items) { result += s; if (i < items.size() - 1) { result += join; i++; ... |
String | internalJoin(String sep, Collection 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); ... |
boolean | isDisjoint(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; |
String | join(AbstractCollection 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(); |
String | join(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()); ... |
StringBuilder | join(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; |
String | join(Collection c) join return join(c, ", "); |
String | join(Collection c, String d) join String result = ""; boolean isFirst = true; for (Object o : c) { result += (isFirst ? "" : d) + o.toString(); isFirst = false; return result; |
String | join(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()); ... |