Interface PersistTaskIterable<A,T>

All Superinterfaces:
PersistTask<A,Iterable<T>>
All Known Subinterfaces:
RetryablePersistTaskIterable<A,T>
All Known Implementing Classes:
AbstractGetNodesArgumentTask, ExpandedTask, GetNodesArgumentTask, GetRecursiveNodesArgumentTask, PartitionedTask, QueryTask

public interface PersistTaskIterable<A,T> extends PersistTask<A,Iterable<T>>
A task that returns an iterable. This class defines combinator methods that only make sense for iterables.
  • Method Details Link icon

    • of Link icon

      static <A, B> PersistTaskIterable<A,B> of(Iterable<B> list)
      Create a task that returns the given list on each run.
    • identity Link icon

      static <A> PersistTaskIterable<A,A> identity()
      Create a task that always returns its argument wrapped in an iterable. Null values are mapped to an empty iterable.
    • map Link icon

      default <V> PersistTaskIterable<A,V> map(PersistTask<T,V> task)
      Creates a composed task which applies the given task to each element of the result of this task and returns a list of all results. This is the same as ```java asIterableTask(this.compose(task.expand(...))) ``` The returned task will never return null. If the listTask did not return a value or the entity list is empty an empty list is returned.
    • forEach Link icon

      default <V> PersistTaskIterable<A,T> forEach(PersistTask<T,V> task)
      uses map(PersistTask) to run the given task for each element, but ignores the result and returns the original task as is
    • flatMap Link icon

      default <V> PersistTaskIterable<A,V> flatMap(PersistTask<T,Iterable<V>> task)
      Creates a composed task which applies the given task to each element of the result of this task and returns a concatenation of the resulting list of lists.
    • filter Link icon

      default PersistTaskIterable<A,T> filter(PersistTask<T,Boolean> predicate)
      Creates a new task that will execute this task and filters the resulting list by applying the given predicate task. Note, that the same predicate task is applied to each element, thus it must be stateless!
    • find Link icon

      default PersistTask<A,T> find(PersistTask<T,Boolean> predicate)
      Return the first element of the result of this that fulfills the given predicate. Apply the predicate to all element of the result of this until an element makes the predicate evaluate to `true`. This element is then returned. The predicate is not applied to subsequent elements. If the predicate returns `null`, it is treated as `false`.
    • get Link icon

      default PersistTask<A,T> get(int index, @Nullable T defaultValue, boolean useDefault)
    • get Link icon

      default PersistTask<A,T> get(int index)
      Return the `index`-th element from the resulting list. An exception is thrown if the index is out of range.
    • get Link icon

      default PersistTask<A,T> get(int index, @Nullable T defaultValue)
      Return the `index`-th element from the resulting list. If the index is out of bounds, return the default value.
    • getOnlyElement Link icon

      default PersistTask<A,T> getOnlyElement(@Nullable T defaultValue, boolean useDefault)
    • getOnlyElement Link icon

      default PersistTask<A,T> getOnlyElement()
      Return the first element or throw an exception if there is more than one element or no element.
    • getOnlyElement Link icon

      default PersistTask<A,T> getOnlyElement(@Nullable T defaultValue)
      Return the first element or the default value if the list is empty. Throw an exception if there is more than one element.