List of utility methods to do Iterator
boolean | removeObject(Object item, Iterator> iter, boolean justFirst) Removes a specified object using an iterator. boolean modified = false; while (iter.hasNext()) { Object o = iter.next(); if (item == null && o == null) { iter.remove(); if (justFirst) return true; if (!modified) ... |
Iterator | removeOnNext(final Iterator remove On Next return new Iterator<T>() { @Override public boolean hasNext() { return iterator.hasNext(); @Override public void remove() { iterator.remove(); ... |
boolean | removeValue(List remove Value if (args.size() > idx) { final String nextArg = args.get(idx); if (!nextArg.startsWith("-")) { it.next(); it.remove(); return true; return false; |
E | retrieveFirstAndExhaustIterator(Iterator Returns the first element and exhausts an iterator E returnVal = null; if (iterator.hasNext()) { returnVal = iterator.next(); exhaustIterator(iterator); return returnVal; |
T | safeAdvance(Iterator safe Advance return iterator.hasNext() ? iterator.next() : null;
|
int | searchIndexInIterator(Iterator search Index In Iterator return searchIndexInIterator(iterator, value, 0);
|
Iterable | shallowUnionColIter(Iterator extends Iterator extends X>> values) shallow Union Col Iter return () -> multiIterator(values);
|
T | single(Iterator single if (i.hasNext()) { return i.next(); return null; |
Iterator | singleElementIterator(T element) single Element Iterator return Arrays.asList(element).iterator();
|
T | singleOrDefault(Iterator single Or Default if (!iterator.hasNext()) { return null; T first = iterator.next(); if (iterator.hasNext()) { throw new IllegalStateException("Expected single result, but got more than one"); return first; ... |