public interface QueryStepBuilder<S,E>
| Modifier and Type | Method and Description |
|---|---|
QueryStepBuilder<S,E> |
and(QueryStepBuilder<E,?>... subqueries) |
UntypedQueryStepBuilder<S,java.lang.Object> |
back(java.lang.String stepName)
Exits the current traversal state and goes back to a named step, or a named set.
|
long |
count()
Counts the number of elements in the current result, and returns that count.
|
QueryStepBuilder<S,E> |
distinct()
Eliminates all duplicated values from the current result.
|
QueryStepBuilder<S,E> |
except(java.util.Set<?> elementsToExclude)
Removes all elements in the given set from the stream.
|
QueryStepBuilder<S,E> |
except(java.lang.String stepName)
Removes all elements from the given named step from this step.
|
QueryStepBuilder<S,E> |
filter(java.util.function.Predicate<E> predicate)
Applies the given filter predicate to all elements in the current result.
|
<T> UntypedQueryStepBuilder<S,T> |
flatMap(java.util.function.Function<E,java.util.Iterator<T>> function)
Uses the given function to map each element to an iterator of output elements.
|
QueryStepBuilder<S,E> |
limit(long limit)
Limits the number of elements in the result set to the given number.
|
<T> UntypedQueryStepBuilder<S,T> |
map(java.util.function.Function<E,T> function)
Uses the given function to map each element from the current result set to a new element.
|
QueryStepBuilder<S,E> |
named(java.lang.String stepName)
Assigns the given name to this
QueryStepBuilder. |
QueryStepBuilder<S,E> |
not(QueryStepBuilder<E,?> subquery) |
QueryStepBuilder<S,E> |
notNull()
Filters out and discards all
null values from the current result set. |
QueryStepBuilder<S,E> |
or(QueryStepBuilder<E,?>... subqueries) |
QueryStepBuilder<S,E> |
orderBy(java.util.Comparator<E> comparator)
Sorts the current result set by applying the given comparator.
|
java.util.Iterator<E> |
toIterator()
Creates an iterator over the elements in this query and returns it.
|
java.util.List<E> |
toList()
Calculates the result of this query and returns it as a
List. |
java.util.Set<E> |
toSet()
Calculates the result set of this query and returns it.
|
java.util.stream.Stream<E> |
toStream()
Converts this query into a
Stream. |
UntypedQueryStepBuilder<S,java.lang.Object> |
union(QueryStepBuilder<E,?>... subqueries) |
QueryStepBuilder<S,E> filter(java.util.function.Predicate<E> predicate)
predicate - The predicate to apply. Must not be null. All elements for which the predicate function
returns false will be filtered out and discarded.null.QueryStepBuilder<S,E> limit(long limit)
Please note that the order of elements is in general arbitrary. Therefore, usually a limit(long) is
preceded by a orderBy(Comparator).
limit - The limit to apply. Must not be negative.null.QueryStepBuilder<S,E> orderBy(java.util.Comparator<E> comparator)
This method requires full resolution of all elements and is therefore non-lazy.
comparator - The comparator to use. Must not be null.null.QueryStepBuilder<S,E> distinct()
This method is lazy, but requires to keep track of the "already encountered" elements in a set. Therefore, RAM consumption on this method may be high if it is applied on very large result sets.
null.<T> UntypedQueryStepBuilder<S,T> map(java.util.function.Function<E,T> function)
function - The mapping function to apply. Must not be null. Should be idempotent and side-effect
free.null.<T> UntypedQueryStepBuilder<S,T> flatMap(java.util.function.Function<E,java.util.Iterator<T>> function)
function - The map function to apply. Must not be null. Should be idempotent and side-effect free.null.QueryStepBuilder<S,E> notNull()
null values from the current result set.
This is the same as:
query.filter(element -> element != null)
null.filter(Predicate)QueryStepBuilder<S,E> named(java.lang.String stepName)
QueryStepBuilder.
Note that only the step is named. When coming back to this step, the query result may be different than it was when it was first reached, depending on the traversal.
stepName - The name of the step. Must not be null. Must be unique within the query.null.back(String)UntypedQueryStepBuilder<S,java.lang.Object> back(java.lang.String stepName)
stepName - The name of the step to go back to. Must not be null, must refer to a named step.null.named(String)QueryStepBuilder<S,E> except(java.lang.String stepName)
stepName - The name of the step. Must not be null, must refer to a named step.null.QueryStepBuilder<S,E> except(java.util.Set<?> elementsToExclude)
elementsToExclude - The elements to remove. Must not be null.null.UntypedQueryStepBuilder<S,java.lang.Object> union(QueryStepBuilder<E,?>... subqueries)
QueryStepBuilder<S,E> and(QueryStepBuilder<E,?>... subqueries)
QueryStepBuilder<S,E> or(QueryStepBuilder<E,?>... subqueries)
QueryStepBuilder<S,E> not(QueryStepBuilder<E,?> subquery)
java.util.Set<E> toSet()
Please note that iterating over the result set via toIterator() is in general faster
and consumes less RAM than first converting the result into a set.
null. May be empty.java.util.List<E> toList()
List.
Please note that iterating over the result via toIterator() is in general faster and
consumes less RAM than first converting the result into a list.
null. May be empty.java.util.Iterator<E> toIterator()
null.java.util.stream.Stream<E> toStream()
Stream.long count()