List of utility methods to do Iterator
void | closeIterator(Iterator> iterator) Closes an iterator if it has interface ClosableIterator. while (iterator.hasNext()) {
iterator.next();
|
int | compareRanges(final Iterator compare Ranges while (i.hasNext() && j.hasNext()) { final E a = i.next(); final E b = j.next(); final int ret = a.compareTo(b); if (ret != 0) { return ret; if (i.hasNext()) { return 1; if (j.hasNext()) { return -1; return 0; |
String | concatinateElements(Iterator> it) concatinate Elements StringBuffer sb = new StringBuffer(); boolean first = true; while (it.hasNext()) { if (!first) { sb.append(", "); Object next = it.next(); String elm = next == null ? "<null>" : next.toString(); ... |
Iterator | concatIterators(final Iterator Concatenate a number of iterators together, to form one big iterator. return new Iterator<E>() { Iterator<E> lastIter = null; List<Iterator<E>> iters = new LinkedList<>(Arrays.asList(iterators)); @Override public boolean hasNext() { return !iters.isEmpty() && iters.get(0).hasNext(); @Override ... |
String | concatLines(Iterator lineIterator) Concatenates several lines into one string. StringBuffer sb = new StringBuffer(); while (lineIterator.hasNext()) { String line = (String) lineIterator.next(); if (line != null) { if (sb.length() != 0) sb.append('\n'); sb.append(line); return sb.length() != 0 ? sb.toString() : null; |
boolean | contains(final Iterator extends E> iter, final E item) Checks if an element item is contained in the iterator sequence. if (iter == null || item == null) { throw new NullPointerException(); while (iter.hasNext()) { if (item.equals(iter.next())) { return true; return false; |
boolean | contains(Iterator extends T> it, T o) contains if (it == null) { throw new IllegalArgumentException("null it"); while (it.hasNext()) { if (o.equals(it.next())) { return true; return false; |
boolean | contains(Iterator> iterator, Object element) Check whether the given Iterator contains the given element. if (iterator != null) { while (iterator.hasNext()) { Object candidate = iterator.next(); if (Objects.equals(candidate, element)) return true; return false; ... |
boolean | contains(Iterator Determines if a String value is included in a Iterated list. if (iterator == null || value == null) { return false; while (iterator.hasNext()) { if (value.equals(iterator.next())) { return true; return false; |
double[] | convertToArray(Iterator convert To Array return listToArray(convertToList(iter));
|