public interface Query<Result>
extends java.lang.Iterable<Result>
Modifier and Type | Method and Description |
---|---|
default boolean |
allMatch(java.util.function.Predicate<? super Result> predicate)
Checks whether predicate is satisfied for every result of this query.
|
default Query<Result> |
allowParallelProcessing() |
default boolean |
anyMatch(java.util.function.Predicate<? super Result> predicate)
Checks whether predicate is satisfied for at least one result of this query.
|
default Query<Result> |
filtering(java.util.function.Predicate<? super Result> predicate) |
java.util.Collection<Result> |
findAll()
Get all of the results in the
Collection |
Result |
findFirst()
Get the first result or
null if no results have been found. |
default <R> Query<R> |
flatMapping(java.util.function.Function<? super Result,? extends Query<? extends R>> mapper) |
boolean |
forEach(Processor<? super Result> consumer)
Process search results one-by-one.
|
AsyncFuture<java.lang.Boolean> |
forEachAsync(Processor<? super Result> consumer) |
default <R> Query<R> |
mapping(java.util.function.Function<? super Result,? extends R> mapper) |
Result [] |
toArray(Result [] a) |
java.util.Collection<Result> findAll()
Collection
Result findFirst()
null
if no results have been found.null
if no results.boolean forEach(Processor<? super Result> consumer)
consumer
passed.
The consumer might be called on different threads, but by default these calls are mutually exclusive, so no additional
synchronization inside consumer is necessary. If you need to process results in parallel, run forEach()
on
the result of allowParallelProcessing()
.consumer
- - a processor search results should be fed to.true
if the search was completed normally,
false
if the occurrence processing was cancelled by the processor.AsyncFuture<java.lang.Boolean> forEachAsync(Processor<? super Result> consumer)
default boolean allMatch(java.util.function.Predicate<? super Result> predicate)
forEach(Processor)
, but has better name.
Use this method only if your predicate is stateless and side-effect free.predicate
- predicate to test on query resultsdefault boolean anyMatch(java.util.function.Predicate<? super Result> predicate)
predicate
- predicate to test on query resultsdefault <R> Query<R> mapping(java.util.function.Function<? super Result,? extends R> mapper)
mapper
- pure functiondefault Query<Result> filtering(java.util.function.Predicate<? super Result> predicate)
predicate
- pure functiondefault <R> Query<R> flatMapping(java.util.function.Function<? super Result,? extends Query<? extends R>> mapper)
mapper
- pure functiondefault Query<Result> allowParallelProcessing()
forEach(com.intellij.util.Processor<? super Result>)
accepts non-thread-safe consumers, so it may call the consumer in parallel.