traverseList<A, B> static method
Map each element in the list to an Option using the function f
,
and collect the result in an Option<List<B>>
.
If any mapped element of the list is None, then the final result will be None.
Same as Option.traverseListWithIndex
but without index
in the map function.
Implementation
static Option<List<B>> traverseList<A, B>(
List<A> list,
Option<B> Function(A a) f,
) =>
traverseListWithIndex<A, B>(list, (a, _) => f(a));