Skip to content

Instantly share code, notes, and snippets.

@kuceraf
Created June 5, 2022 13:00
Show Gist options
  • Save kuceraf/b484d58b784a045952e0d5df06afa00c to your computer and use it in GitHub Desktop.
Save kuceraf/b484d58b784a045952e0d5df06afa00c to your computer and use it in GitHub Desktop.
fun main() {
runBlocking {
uuidFlow().collect{ log(it.toString()) }
}
}
fun uuidFlow(): Flow<UUID> = flow {
while (true) {
delay(100)
emit(UUID.randomUUID())
}
}
fun log(message: String) {
println("${Thread.currentThread().name}: $message")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment