|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cosylab.util.Iterators
public class Iterators
Utilities for working with iterators.
Constructor Summary | |
---|---|
Iterators()
|
Method Summary | ||
---|---|---|
static boolean |
areEqual(java.util.Iterator<? extends java.lang.Object> iterA,
java.util.Iterator<? extends java.lang.Object> iterB)
Determine whether two iterators iterate through the same set of elements. |
|
static boolean |
areEqualOrder(java.util.Iterator<? extends java.lang.Object> iterA,
java.util.Iterator<? extends java.lang.Object> iterB)
Do two iterators iterate through the same elements in the same order? |
|
static
|
distinct(java.util.Iterator<T> iter)
Create an iterator that iterates only through distinct values. |
|
static
|
intersect(java.util.Iterator<T> iterA,
java.util.Iterator<T> iterB)
Intersection of two iterators. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Iterators()
Method Detail |
---|
public static boolean areEqual(java.util.Iterator<? extends java.lang.Object> iterA, java.util.Iterator<? extends java.lang.Object> iterB)
Note: This implementation is not efficient for iterators over large sets, as it first puts elements of both iterators in two sets, and then compares the sets.
iterA
- First iterator.iterB
- Second iterator.
true
if elements are the same.public static boolean areEqualOrder(java.util.Iterator<? extends java.lang.Object> iterA, java.util.Iterator<? extends java.lang.Object> iterB)
iterA
- First iterator.iterB
- Second iterator.
true
if the iteration order is the same.public static <T> java.util.Iterator<T> intersect(java.util.Iterator<T> iterA, java.util.Iterator<T> iterB)
Note: the implementation is such that the first iterator (iterA
)
is first traversed in its entirety. Whenever possible, iterA
should be the shorter of the two iterators.
T
- Type across which the iterator iterates.iterA
- First iterator.iterB
- Second iterator.
iterA
and
iterB
.public static <T> java.util.Iterator<T> distinct(java.util.Iterator<T> iter)
T
- Type across which the iterator is iterating.iter
- The underlying iterator.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |