history

fun <T> Stream<T>.history(capacity: Int): Stream<List<T>>

Records the latest incoming values up to the given capacity.