intercalate method
Inserts an iterable in between iterables and concatenates the result.
[1, 2, 3, 4].intercalate(0, 0) returns (1, 0, 0, 2, 0, 0, 3, 0, 0, 4).
Optional count and skip:
[1, 2, 3, 4].intercalate(0, 0, count: 1) returns (1, 0, 0, 2, 3, 4).
[1, 2, 3, 4].intercalate(0, 0, skip: 1) returns (1, 2, 0, 0, 3, 0, 0, 4).
reverse starts the count from right to left:
[1, 2, 3, 4].intercalate(0, 0, count: 1, reverse: true) returns (1, 2, 3, 0, 0, 4).
Returns the original concatenated if skip is negative or too high, count <= 0, or
original has less than two iterables.
Implementation
Iterable<E> intercalate(
Iterable<E> input, {
int? count,
int skip = 0,
bool reverse = false,
}) {
return h.intercalateIterable(
sub: input,
original: this,
count: count,
skip: skip,
reverse: reverse,
);
}