List of utility methods to do Iterator
boolean | hasNexts(List has Nexts return heads.stream().anyMatch(Iterator::hasNext);
|
boolean | hasOpenIteratorsRequiringOpenConnection() Returns whether there is at least one open iterator which requires an open connection final Map<Iterator<?>, Boolean> iterators = OPEN_ITERATORS.get(); if (iterators != null) { for (final Boolean requiresOpenConnection : iterators.values()) { if (Boolean.TRUE.equals(requiresOpenConnection)) { return true; return false; |
int | hex(Iterator hex if (it.hasNext()) { Integer nx = it.next(); if (nx == '%') { int hi = Character.digit(it.next(), 16); int lo = Character.digit(it.next(), 16); return ((hi << 4) | lo) & 0x3f; } else return nx; ... |
String | implode(Iterator it) implode StringBuilder sb = new StringBuilder(); while (it.hasNext()) { sb.append(it.next()); sb.append(", "); return sb.toString().replaceAll(", +$", ""); |
boolean | isBlank(Iterator iterator) is Blank return !isPresent(iterator);
|
boolean | isIterator(Class> clazz) is Iterator return Iterator.class.isAssignableFrom(clazz); |
boolean | isPrefixOf(Iterator is Prefix Of while (pref.hasNext()) { T v = pref.next(); if (!target.hasNext()) { return false; if (!v.equals(target.next())) { return false; return true; |
Iterable | iterable(Iterator Allow iterator to be used in a for each loop. return new Iterable<T>() { @Override public Iterator<T> iterator() { return iterator; }; |
int | length(Iterator> iter) length int len = 0; while (iter.hasNext()) { iter.next(); ++len; return len; |
Iterator | limit(final Iterator limit return new Iterator<R>() { private int iterated; @Override public boolean hasNext() { return iterated < limit && iterator.hasNext(); @Override public R next() { ... |