traverseList<A, B> static method

TaskOption<List<B>> traverseList<A, B>(
  1. List<A> list,
  2. TaskOption<B> f(
    1. A a
    )
)

Map each element in the list to a TaskOption using the function f, and collect the result in an TaskOption<List<B>>.

Each TaskOption is executed in parallel. This strategy is faster than sequence, but the order of the request is not guaranteed.

If you need TaskOption to be executed in sequence, use traverseListWithIndexSeq.

Same as TaskOption.traverseListWithIndex but without index in the map function.

Implementation

static TaskOption<List<B>> traverseList<A, B>(
  List<A> list,
  TaskOption<B> Function(A a) f,
) =>
    traverseListWithIndex<A, B>(list, (a, _) => f(a));