public class IntersectIteration<E,X extends Exception> extends FilterIteration<E,X>
Note that duplicates can also be filtered by wrapping this Iteration in a DistinctIteration
, but that has a
bit more overhead as it adds a second hash table lookup.
Modifier and Type | Field and Description |
---|---|
protected Iteration<? extends E,? extends X> |
arg2 |
wrappedIter
Constructor and Description |
---|
IntersectIteration(Iteration<? extends E,? extends X> arg1,
Iteration<? extends E,? extends X> arg2)
Creates a new IntersectIteration that returns the intersection of the results of two Iterations.
|
IntersectIteration(Iteration<? extends E,? extends X> arg1,
Iteration<? extends E,? extends X> arg2,
boolean distinct)
Creates a new IntersectIteration that returns the intersection of the results of two Iterations.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
accept(E object)
Returns true if the object is in the set of elements of the second argument.
|
Set<E> |
addSecondSet(Iteration<? extends E,? extends X> arg2,
Set<E> set) |
protected long |
clearIncludeSet() |
protected void |
handleClose()
Closes this Iteration and also closes the wrapped Iteration if it is a
CloseableIteration . |
protected boolean |
inIncludeSet(E object) |
protected Set<E> |
makeSet() |
protected boolean |
removeFromIncludeSet(E object) |
hasNext, next
remove
close, isClosed
public IntersectIteration(Iteration<? extends E,? extends X> arg1, Iteration<? extends E,? extends X> arg2)
arg1
- An Iteration containing the first set of elements.arg2
- An Iteration containing the second set of elements.public IntersectIteration(Iteration<? extends E,? extends X> arg1, Iteration<? extends E,? extends X> arg2, boolean distinct)
arg1
- An Iteration containing the first set of elements.arg2
- An Iteration containing the second set of elements.distinct
- Flag indicating whether duplicate elements should be filtered from the result.protected boolean accept(E object) throws X extends Exception
public Set<E> addSecondSet(Iteration<? extends E,? extends X> arg2, Set<E> set) throws X extends Exception
protected boolean removeFromIncludeSet(E object)
protected boolean inIncludeSet(E object)
protected void handleClose() throws X extends Exception
IterationWrapper
CloseableIteration
.handleClose
in class FilterIteration<E,X extends Exception>
X
X extends Exception
protected long clearIncludeSet()
Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.