zipWith<U, R> abstract method

  1. @useResult
Option<R> zipWith<U, R>(
  1. Option<U> other,
  2. R zip(
    1. T value,
    2. U otherValue
    )
)

Returns the result of zip called with both this and other if both are Some, or None otherwise.

Examples

// prints "Some((2, some))"
print(const Some(2).zipWith(const Some('some'), (a, b) => (a, b)));

// prints "None"
print(const Some(2).zipWith(const None<String>(), (a, b) => (a, b)));

Implementation

@useResult
Option<R> zipWith<U, R>(Option<U> other, R Function(T value, U otherValue) zip);