repeatAndCollect

suspend fun <R> repeatAndCollect(times: Long = 3, delay: Duration = 500.milliseconds, block: suspend () -> R): List<R>(source)

Repeats an operation and collects all results.

Return

List of all results collected (initial execution + repeats)

Parameters

times

The number of times to repeat after the initial execution (defaults to 3)

delay

The delay between repetitions (defaults to 500 milliseconds)

block

The suspend operation to repeat

Type Parameters

R

The return type of the suspend operation

Throws

if any execution fails