net.sf.molae.pipe.tree
Class DepthFirstCollection<E>
java.lang.Object
java.util.AbstractCollection<E>
net.sf.molae.pipe.tree.DepthFirstCollection<E>
- All Implemented Interfaces:
- Iterable<E>, Collection<E>
public final class DepthFirstCollection<E>
- extends AbstractCollection<E>
A collection based on the DepthFirstIterator
.
Methods inherited from class java.util.AbstractCollection |
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString |
DepthFirstCollection
public DepthFirstCollection(E base,
CompositionView<E> compositionView)
- Constructs a
DepthFirstCollection
.
- Parameters:
base
- the root object of the tree -
must not be an Iterator
.compositionView
- the compositionView to be used
newInstance
public static DepthFirstCollection<Object> newInstance(Object base)
- Constructs a
DepthFirstCollection
.
- Parameters:
base
- the root object of the tree -
must not be an Iterator
.
iterator
public Iterator<E> iterator()
- Specified by:
iterator
in interface Iterable<E>
- Specified by:
iterator
in interface Collection<E>
- Specified by:
iterator
in class AbstractCollection<E>
size
public int size()
- Uses the iterator to count the elements.
- Specified by:
size
in interface Collection<E>
- Specified by:
size
in class AbstractCollection<E>