Java Utililty Methods Iterator Join

List of utility methods to do Iterator Join

Description

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

Method

Stringjoin(Iterator iterator, String s)
join
StringBuffer stringbuffer = new StringBuffer();
do {
    if (!iterator.hasNext())
        break;
    stringbuffer.append(iterator.next());
    if (iterator.hasNext())
        stringbuffer.append(s);
} while (true);
...
Stringjoin(Iterator iterator, String separator)

Joins the elements of the provided Iterator into a single String containing the provided elements.

if (separator == null) {
    separator = "";
StringBuffer buf = new StringBuffer(256); 
while (iterator.hasNext()) {
    buf.append(iterator.next());
    if (iterator.hasNext()) {
        buf.append(separator);
...
Stringjoin(Iterator iterator, String separator)
join
if (iterator == null) {
    return null;
if (!iterator.hasNext()) {
    return EMPTY;
Object first = iterator.next();
if (!iterator.hasNext()) {
...
Stringjoin(Iterator objects, String separator)
join
StringBuffer buf = new StringBuffer();
if (objects.hasNext())
    buf.append(objects.next());
while (objects.hasNext()) {
    buf.append(separator).append(objects.next());
return buf.toString();
Stringjoin(Iterator iterator, String separator)
Joins a iteratable list of objects by the given separator
if (iterator == null)
    return "";
Object first = iterator.next();
if (!iterator.hasNext())
    return first.toString();
StringBuilder buf = new StringBuilder();
if (first != null) {
    buf.append(first);
...
Stringjoin(Iterator iterator)
join
StringBuilder builder = new StringBuilder();
while (iterator.hasNext()) {
    builder.append(iterator.next());
    if (iterator.hasNext()) {
        builder.append(", ");
return builder.toString();
...
Stringjoin(String delimiter, Iterator iterator)
join
if (delimiter == null) {
    delimiter = EMPTY_STRING;
if (!iterator.hasNext()) {
    return EMPTY_STRING;
Object first = iterator.next();
if (!iterator.hasNext()) {
...
Stringjoin(String seperator, Iterator objects)
join
StringBuffer buf = new StringBuffer();
if (objects.hasNext())
    buf.append(objects.next());
while (objects.hasNext()) {
    buf.append(seperator).append(objects.next());
return buf.toString();
Stringjoin(String seperator, Iterator objects)
join
StringBuffer sb = new StringBuffer();
if (objects.hasNext())
    sb.append(objects.next());
while (objects.hasNext()) {
    sb.append(seperator).append(objects.next());
return sb.toString();
IteratorjoinIterators(final Iterator... iterators)
join Iterators
return new Iterator<T>() {
    private int next = 0;
    @Override
    public boolean hasNext() {
        while (next < iterators.length && !iterators[next].hasNext()) {
            next++;
        return next < iterators.length;
...