mapWindows<U> method

  1. @override
Iter<U> mapWindows<U>(
  1. int size,
  2. U f(
    1. Arr<T>
    )
)

Calls the given function f for each contiguous window of size over self and returns an iterator over the outputs of f e.g. 1, 2, 3, 4 with size 2 will yield windows of 1, 2, 2, 3, 3, 4 The windows indicies should be treated as immutable, as they are shared between calls to minize allocations. Therefore, you should not modify or store the window, but clone it if you need to.

Implementation

@override
@pragma("vm:prefer-inline")
Iter<U> mapWindows<U>(int size, U Function(Arr<T>) f) {
  assert(size > 0, "Size must be greater than 0");
  return Iter.fromIterable(_mapWindowsHelper(size, f));
}