TResult - result typeTSource - left input record typeTKey - key typeTInner - right input record typeprivate static class EnumerableDefaults.MergeJoinEnumerator<TResult,TSource,TInner,TKey extends Comparable<TKey>> extends Object implements Enumerator<TResult>
| Modifier and Type | Field and Description |
|---|---|
(package private) Enumerator<List<Object>> |
cartesians |
(package private) boolean |
done |
private Function1<TInner,TKey> |
innerKeySelector |
private Enumerator<TSource> |
leftEnumerator |
(package private) List<TSource> |
lefts |
private Function1<TSource,TKey> |
outerKeySelector |
private Function2<TSource,TInner,TResult> |
resultSelector |
private Enumerator<TInner> |
rightEnumerator |
(package private) List<TInner> |
rights |
| Constructor and Description |
|---|
MergeJoinEnumerator(Enumerator<TSource> leftEnumerator,
Enumerator<TInner> rightEnumerator,
Function1<TSource,TKey> outerKeySelector,
Function1<TInner,TKey> innerKeySelector,
Function2<TSource,TInner,TResult> resultSelector) |
| Modifier and Type | Method and Description |
|---|---|
private boolean |
advance()
Moves to the next key that is present in both sides.
|
void |
close()
Closes this enumerable and releases resources.
|
TResult |
current()
Gets the current element in the collection.
|
boolean |
moveNext()
Advances the enumerator to the next element of the collection.
|
void |
reset()
Sets the enumerator to its initial position, which is before the first
element in the collection.
|
private void |
start() |
private final Enumerator<TSource> leftEnumerator
private final Enumerator<TInner> rightEnumerator
private final Function1<TSource,TKey extends Comparable<TKey>> outerKeySelector
private final Function1<TInner,TKey extends Comparable<TKey>> innerKeySelector
boolean done
Enumerator<List<Object>> cartesians
private void start()
private boolean advance()
public TResult current()
EnumeratorAfter an enumerator is created or after the Enumerator.reset() method is
called, the Enumerator.moveNext() method must be called to advance the
enumerator to the first element of the collection before reading the
value of the current property; otherwise, current is
undefined.
This method also throws NoSuchElementException if
the last call to moveNext returned false, which indicates
the end of the collection.
This method does not move the position of the enumerator, and
consecutive calls to current return the same object until either
moveNext or reset is called.
An enumerator remains valid as long as the collection remains
unchanged. If changes are made to the collection, such as adding,
modifying, or deleting elements, the enumerator is irrecoverably
invalidated. The next call to moveNext or reset may,
at the discretion of the implementation, throw a
ConcurrentModificationException. If the collection is
modified between moveNext and current, current
returns the element that it is set to, even if the enumerator is already
invalidated.
current in interface Enumerator<TResult>public boolean moveNext()
EnumeratorAfter an enumerator is created or after the reset method is
called, an enumerator is positioned before the first element of the
collection, and the first call to the moveNext method moves the
enumerator over the first element of the collection.
If moveNext passes the end of the collection, the enumerator
is positioned after the last element in the collection and
moveNext returns false. When the enumerator is at this
position, subsequent calls to moveNext also return false
until #reset is called.
An enumerator remains valid as long as the collection remains
unchanged. If changes are made to the collection, such as adding,
modifying, or deleting elements, the enumerator is irrecoverably
invalidated. The next call to moveNext or Enumerator.reset() may,
at the discretion of the implementation, throw a
ConcurrentModificationException.
moveNext in interface Enumerator<TResult>true if the enumerator was successfully advanced to the
next element; false if the enumerator has passed the end of
the collectionpublic void reset()
EnumeratorAn enumerator remains valid as long as the collection remains
unchanged. If changes are made to the collection, such as adding,
modifying, or deleting elements, the enumerator is irrecoverably
invalidated. The next call to Enumerator.moveNext() or reset may,
at the discretion of the implementation, throw a
ConcurrentModificationException.
This method is optional; it may throw
UnsupportedOperationException.
Notes to Implementers
All calls to Reset must result in the same state for the enumerator.
The preferred implementation is to move the enumerator to the beginning
of the collection, before the first element. This invalidates the
enumerator if the collection has been modified since the enumerator was
created, which is consistent with Enumerator.moveNext() and
Enumerator.current().
reset in interface Enumerator<TResult>public void close()
EnumeratorThis method is idempotent. Calling it multiple times has the same effect as calling it once.
close in interface AutoCloseableclose in interface Enumerator<TResult>Copyright © 2012–2021 The Apache Software Foundation. All rights reserved.