Java Utililty Methods Iterator

List of utility methods to do Iterator

  1. HOME
  2. Java
  3. I
  4. Iterator

Description

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

Method

void addAll(Collection dest, Iterator src)
Adds all the elements from an iterator to a collection.
while (src.hasNext())
 dest.add(src.next());
void addAll(Collection dest, Iterator src)
add All
if (src != null) {
 while (src.hasNext()) {
 T value = src.next();
 dest.add(value);
C addAll(final C collection, final Iterator iter)
adds all elements from iter to collection
while (iter.hasNext()) {
 collection.add(iter.next());
return collection;
void addAll(final Collection targetCollection, final Iterator sourceIterator)
Adds all elements that a given Iterator provides to a given Collection of appropriate type
while (sourceIterator.hasNext()) {
 targetCollection.add(sourceIterator.next());
void addAll(Iterator iteratorFrom, Collection collectionTo)
If the given Iterator is not null, iterate over all T elements in it and add them to the given Collection.
if (iteratorFrom != null) {
 while (iteratorFrom.hasNext()) {
 collectionTo.add(iteratorFrom.next());
U addAll(Iterator source, U target)
Add all items in iterator to target collection
while (source.hasNext()) {
 target.add(source.next());
return target; 
List addAll(List target, Iterator source)
add All
if (source == null)
 return target;
for (; source.hasNext(); target.add(source.next()))
 ;
return target;
void addAll(Set s, Iterator i)
add All
while (i != null && i.hasNext()) {
 s.add(i.next());
COLL addAllFromIterator(COLL dest, Iterator source)
add All From Iterator
while (source.hasNext()) {
 dest.add(source.next());
return dest;
LinkedList addAllToList(Iterator i)
Adds all elements of iterator's range to a new linked list.
LinkedList<T> result = new LinkedList<T>();
while (i.hasNext()) {
 result.add(i.next());
return result;


AltStyle によって変換されたページ (->オリジナル) /