List of utility methods to do Iterator
void | addAllToSet(Set add All To Set while (it.hasNext()) {
set.add(it.next());
|
C | addTo(final Iterator add To while (iter.hasNext()) c.add(iter.next()); return c; |
void | appendTo(final Iterator Appends all elements which the iterator is willing to produce to the given list. assert null != iter; assert null != list; while (iter.hasNext()) { list.add(iter.next()); |
boolean | areEqual(final Iterator a, final Iterator b) are Equal while (a.hasNext() || b.hasNext()) { if (a.hasNext() != b.hasNext()) return false; if (!a.next().equals(b.next())) return false; return true; |
boolean | areEqual(final Iterator ittyA, final Iterator ittyB) Checks if the contents of the two iterators are equal and of the same length. if (ittyA.hasNext() != ittyB.hasNext()) return false; while (ittyA.hasNext()) { if (!ittyB.hasNext()) return false; if (ittyA.next() != ittyB.next()) return false; return true; |
T[] | asArray(T[] arr, Iterator as Array ArrayList<T> lst = new ArrayList<T>(); while (itr.hasNext()) { lst.add(itr.next()); Class tclass = arr.getClass().getComponentType(); return lst.toArray(arr); |
List | asList(final Iterator Converts a given iterator in a list. final List<T> result = new ArrayList<T>(); while (iterator.hasNext()) { result.add(iterator.next()); return result; |
List | asList(Iterator extends T> it) as List List<T> lst = new ArrayList<T>(); while (it.hasNext()) { lst.add(it.next()); return lst; |
void | asStringOn(StringBuffer sb, Iterator iter, String separator) Copies the elements returned by the iterator onto the string buffer each delimited by the separator. if (!iter.hasNext()) return; sb.append(iter.next()); while (iter.hasNext()) { sb.append(separator); sb.append(iter.next()); |
Iterator | cast(Iterator> p) cast return (Iterator<T>) p;
|