riffleOut method

Queue<E> riffleOut({
  1. bool inverse = false,
})

Splits into two and uses interleave to combine.

1, 2, 3, 4, 5, 6.riffleOut() returns 1, 4, 2, 5, 3, 6. 1, 2, 3, 4, 5, 6.riffleIn() returns 4, 1, 5, 2, 6, 3.

Odd number of elements: 1, 2, 3, 4, 5.riffleOut() returns 1, 4, 2, 5, 3 1, 2, 3, 4, 5.riffleIn() returns 3, 1, 4, 2, 5

inverse goes back to original: 1, 4, 2, 5, 3.riffleOut(inverse: true) returns 1, 2, 3, 4, 5.

Implementation

Queue<E> riffleOut({bool inverse = false}) {
  return h.riffleOutIterable(original: this, inverse: inverse).toQueue();
}