List of utility methods to do Iterable Join
Iterable extends T> | join(final Iterable extends T>... iterables) join return new Iterable<T>() { public Iterator<T> iterator() { return new Iterator<T>() { int index; Iterator<? extends T> current; T next; public boolean hasNext() { if (next == null) { ... |
String | join(final Iterable> items, final String separator) Pick all elements from the iterable items and convert their string representation into a separator -separated single string. final StringBuilder sequence = new StringBuilder(); final Iterator<?> iter = items.iterator(); if (iter.hasNext()) { final String first = iter.next().toString(); sequence.append(first); while (iter.hasNext()) { sequence.append(separator); final String next = iter.next().toString(); ... |
String | join(final Iterable> iterable, final String separator) Copied fom commons StringUtils Joins the elements of the provided Iterable into a single String containing the provided elements. if (iterable == null) { return null; return join(iterable.iterator(), separator); |
String | join(final Iterable join return join(container, ""); |
String | join(final Iterable join return join(iterable.iterator(), joinString);
|
String | join(final Iterable Source: http://snippets.dzone.com/posts/show/91 Iterator<T> iter = objs.iterator(); if (!iter.hasNext()) return ""; StringBuffer buffer = new StringBuffer(String.valueOf(iter.next())); while (iter.hasNext()) buffer.append(delimiter).append(String.valueOf(iter.next())); return buffer.toString(); |
String | join(final Iterable join Iterator<T> iter = objs.iterator(); if (!iter.hasNext()) { return ""; StringBuffer buffer = new StringBuffer(String.valueOf(iter.next())); while (iter.hasNext()) { buffer.append(delimiter).append(String.valueOf(iter.next())); return buffer.toString(); |
String | join(final Iterable join return join(source, DEFAULT_JOIN_SEPARATOR, DEFAULT_JOIN_NULL_BEHAVIOR);
|
Iterable | join(final Iterable join multiple iterables into one return () -> new Iterator<T>() { private int which = 0; private Iterator<T> iterator = null; while (which < iterables.length) { iterator = iterables[which].iterator(); if (iterator.hasNext()) break; ... |
String | join(final String delimiter, final Iterable join if (objs == null) return ""; Iterator<T> iter = objs.iterator(); if (!iter.hasNext()) return ""; String delim = delimiter; if (delimiter == null) delim = ""; ... |