Top Description Inners Constructors Methods
com.sun.xml.xsom.impl.scd

public Class Iterators

extends Object
Class Inheritance
Imports
java.util.Iterator, .NoSuchElementException, .Set, .HashSet, .Collections

Various convenient Iterator implementations.
Author
Kohsuke Kawaguchi

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
Iterators.Adapter<T, U>

Iterator that wraps another Iterator and changes its type.

public static class
Iterators.Array<T>

Array iterator.

public abstract static class
Iterators.Filter<T>

Filter out objects from another iterator.

public abstract static class
Iterators.Map<T, U>

For each U, apply U->Iterator<T> function and then iterate all the resulting T.

pack-priv abstract static class
pack-priv static class
Iterators.Singleton<T>

Iterator that returns a single (or no) value.

public static class
Iterators.Union<T>

Union of two iterators.

pack-priv static class
Iterators.Unique<T>

Only return unique items.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static <T> Iterator<T>
public static <T> Iterator<T>
singleton(T value)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Iteratorsback to summary
public Iterators()

Method Detail

emptyback to summary
public static <T> Iterator<T> empty()
singletonback to summary
public static <T> Iterator<T> singleton(T value)
com.sun.xml.xsom.impl.scd back to summary

public abstract Class Iterators.Adapter<T, U>

extends Iterators.ReadOnly<T>
Class Inheritance

Iterator that wraps another Iterator and changes its type.

Field Summary

Modifier and TypeField and Description
private final Iterator<? extends U>

Constructor Summary

AccessConstructor and Description
public
Adapter(Iterator<? extends U> core)

Method Summary

Modifier and TypeMethod and Description
protected abstract T
filter(U u)

public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public T
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

Inherited from com.sun.xml.xsom.impl.scd.Iterators.ReadOnly:
remove

Field Detail

coreback to summary
private final Iterator<? extends U> core

Constructor Detail

Adapterback to summary
public Adapter(Iterator<? extends U> core)

Method Detail

filterback to summary
protected abstract T filter(U u)
hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

nextback to summary
public T next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

com.sun.xml.xsom.impl.scd back to summary

public final Class Iterators.Array<T>

extends Iterators.ReadOnly<T>
Class Inheritance

Array iterator.

Field Summary

Modifier and TypeField and Description
private int
private final T[]

Constructor Summary

AccessConstructor and Description
public
Array(T[] items)

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public T
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

Inherited from com.sun.xml.xsom.impl.scd.Iterators.ReadOnly:
remove

Field Detail

indexback to summary
private int index
itemsback to summary
private final T[] items

Constructor Detail

Arrayback to summary
public Array(T[] items)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

nextback to summary
public T next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

com.sun.xml.xsom.impl.scd back to summary

public abstract Class Iterators.Filter<T>

extends Iterators.ReadOnly<T>
Class Inheritance
Known Direct Subclasses
com.sun.xml.xsom.impl.scd.Iterators.Unique

Filter out objects from another iterator.

Field Summary

Modifier and TypeField and Description
private final Iterator<? extends T>
private T

Constructor Summary

AccessConstructor and Description
protected
Filter(Iterator<? extends T> core)

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

protected abstract boolean
matches(T value)

Return true to retain the value.

public T
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

Inherited from com.sun.xml.xsom.impl.scd.Iterators.ReadOnly:
remove

Field Detail

coreback to summary
private final Iterator<? extends T> core
nextback to summary
private T next

Constructor Detail

Filterback to summary
protected Filter(Iterator<? extends T> core)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

matchesback to summary
protected abstract boolean matches(T value)

Return true to retain the value.

nextback to summary
public T next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

com.sun.xml.xsom.impl.scd back to summary

public abstract Class Iterators.Map<T, U>

extends Iterators.ReadOnly<T>
Class Inheritance

For each U, apply U->Iterator<T> function and then iterate all the resulting T.

Field Summary

Modifier and TypeField and Description
private final Iterator<? extends U>
private Iterator<? extends T>

Constructor Summary

AccessConstructor and Description
protected
Map(Iterator<? extends U> core)

Method Summary

Modifier and TypeMethod and Description
protected abstract Iterator<? extends T>
apply(U u)

public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public T
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

Inherited from com.sun.xml.xsom.impl.scd.Iterators.ReadOnly:
remove

Field Detail

coreback to summary
private final Iterator<? extends U> core
currentback to summary
private Iterator<? extends T> current

Constructor Detail

Mapback to summary
protected Map(Iterator<? extends U> core)

Method Detail

applyback to summary
protected abstract Iterator<? extends T> apply(U u)
hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

nextback to summary
public T next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

com.sun.xml.xsom.impl.scd back to summary

pack-priv abstract Class Iterators.ReadOnly<T>

extends Object
implements Iterator<T>
Class Inheritance
All Implemented Interfaces
java.util.Iterator
Known Direct Subclasses
com.sun.xml.xsom.impl.scd.Iterators.Singleton, com.sun.xml.xsom.impl.scd.Iterators.Adapter, com.sun.xml.xsom.impl.scd.Iterators.Map, com.sun.xml.xsom.impl.scd.Iterators.Filter, com.sun.xml.xsom.impl.scd.Iterators.Union, com.sun.xml.xsom.impl.scd.Iterators.Array

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public final void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ReadOnlyback to summary
pack-priv ReadOnly()

Method Detail

removeback to summary
public final void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

com.sun.xml.xsom.impl.scd back to summary

pack-priv final Class Iterators.Singleton<T>

extends Iterators.ReadOnly<T>
Class Inheritance

Iterator that returns a single (or no) value.

Field Summary

Modifier and TypeField and Description
private T

Constructor Summary

AccessConstructor and Description
pack-priv
Singleton(T next)

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public T
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

Inherited from com.sun.xml.xsom.impl.scd.Iterators.ReadOnly:
remove

Field Detail

nextback to summary
private T next

Constructor Detail

Singletonback to summary
pack-priv Singleton(T next)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

nextback to summary
public T next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

com.sun.xml.xsom.impl.scd back to summary

public final Class Iterators.Union<T>

extends Iterators.ReadOnly<T>
Class Inheritance

Union of two iterators.

Field Summary

Modifier and TypeField and Description
private final Iterator<? extends T>
private final Iterator<? extends T>

Constructor Summary

AccessConstructor and Description
public
Union(Iterator<? extends T> first, Iterator<? extends T> second)

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.

public T
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.

Inherited from com.sun.xml.xsom.impl.scd.Iterators.ReadOnly:
remove

Field Detail

firstback to summary
private final Iterator<? extends T> first
secondback to summary
private final Iterator<? extends T> second

Constructor Detail

Unionback to summary
public Union(Iterator<? extends T> first, Iterator<? extends T> second)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

nextback to summary
public T next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

com.sun.xml.xsom.impl.scd back to summary

pack-priv final Class Iterators.Unique<T>

extends Iterators.Filter<T>
Class Inheritance

Only return unique items.

Field Summary

Modifier and TypeField and Description
private Set<T>

Constructor Summary

AccessConstructor and Description
public
Unique(Iterator<? extends T> core)

Method Summary

Modifier and TypeMethod and Description
protected boolean
matches(T value)

Implements abstract com.sun.xml.xsom.impl.scd.Iterators.Filter.matches.

Return true to retain the value.

Inherited from com.sun.xml.xsom.impl.scd.Iterators.Filter:
hasNextnext

Field Detail

valuesback to summary
private Set<T> values

Constructor Detail

Uniqueback to summary
public Unique(Iterator<? extends T> core)

Method Detail

matchesback to summary
protected boolean matches(T value)

Implements abstract com.sun.xml.xsom.impl.scd.Iterators.Filter.matches.

Doc from com.sun.xml.xsom.impl.scd.Iterators.Filter.matches.

Return true to retain the value.