intersperse method
Adds element
between elements of the iterable.
Example: if we have [1, 2, 3]
and adds 0
, then as a result
we will have [1, 0, 2, 0, 3]
.
If iterable is empty then returns empty iterable.
If iterable have only one element then returns interable with only one element.
Implementation
Iterable<E> intersperse(E element) =>
isEmpty ? [] : IntersperseIterable(this, element);