E
- entity type being selected.public abstract class BaseResult<E> extends Object implements Result<E>, CloseableIterable<E>
Result
implementation.Modifier | Constructor and Description |
---|---|
protected |
BaseResult() |
protected |
BaseResult(Integer maxSize) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close this result and any resources it holds.
|
<C extends Collection<E>> |
collect(C collection)
Fill the given collection with all elements from this result set.
|
void |
each(Consumer<? super E> action)
Consume the results with the given
Consumer . |
E |
first()
Gets the first element of this result set.
|
E |
firstOr(E defaultElement)
Gets the first element or a default value.
|
E |
firstOr(Supplier<E> supplier)
Gets the first element or a default value from a
Supplier . |
E |
firstOrNull()
Gets the first element or a default null value.
|
CloseableIterator<E> |
iterator() |
abstract CloseableIterator<E> |
iterator(int skip,
int take)
Creates a
AutoCloseable Iterator over a window of the elements
in this result. |
Stream<E> |
stream() |
List<E> |
toList()
Converts this result into a list.
|
<K> Map<K,E> |
toMap(Expression<K> key)
Map the results into a new map using an expression of the result element as a key.
|
<K> Map<K,E> |
toMap(Expression<K> key,
Map<K,E> map)
Map the results into the given map using an expression of the result element as a key.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
protected BaseResult()
protected BaseResult(Integer maxSize)
public abstract CloseableIterator<E> iterator(int skip, int take)
Result
AutoCloseable
Iterator
over a window of the elements
in this result.public List<E> toList()
Result
public <C extends Collection<E>> C collect(C collection)
Result
public E first()
Result
public E firstOr(E defaultElement)
Result
public E firstOr(Supplier<E> supplier)
Result
Supplier
.public E firstOrNull()
Result
firstOrNull
in interface Result<E>
public CloseableIterator<E> iterator()
public void each(Consumer<? super E> action)
Result
Consumer
. In Java 8 use Iterable.forEach(java.util.function.Consumer<? super T>)
instead.public <K> Map<K,E> toMap(Expression<K> key)
Result
public <K> Map<K,E> toMap(Expression<K> key, Map<K,E> map)
Result