partition method

Tuple2<ImmortalList<T>, ImmortalList<T>> partition(
  1. bool predicate(
    1. T value
    )
)

Returns a tuple of two new lists by splitting the list into two depending on the result of the given predicate.

The first list will contain all elements that satisfy predicate and the remaining elements will produce the second list. The iteration order is preserved in both lists.

Implementation

Tuple2<ImmortalList<T>, ImmortalList<T>> partition(
  bool Function(T value) predicate,
) =>
    Tuple2(where(predicate), removeWhere(predicate));