File tree 4 files changed +8
-5
lines changed
kotlinx-coroutines-core/jvm/test/guide
4 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -273,7 +273,6 @@ The `develop` branch is pushed to `master` during release.
273
273
[ ListenableFuture.await ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-guava/kotlinx.coroutines.guava/com.google.common.util.concurrent.-listenable-future/await.html
274
274
<!-- - MODULE kotlinx-coroutines-play-services -->
275
275
<!-- - INDEX kotlinx.coroutines.tasks -->
276
- [ Task.await ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-play-services/kotlinx.coroutines.tasks/com.google.android.gms.tasks.-task/await.html
277
276
<!-- - MODULE kotlinx-coroutines-reactive -->
278
277
<!-- - INDEX kotlinx.coroutines.reactive -->
279
278
[ Publisher.collect ] : https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-reactive/kotlinx.coroutines.reactive/org.reactivestreams.-publisher/collect.html
Original file line number Diff line number Diff line change @@ -209,7 +209,9 @@ fun main() = runBlocking {
209
209
// sampleStart
210
210
val numbers = produceNumbers() // produces integers from 1 and on
211
211
val squares = square(numbers) // squares integers
212
- for (i in 1 .. 5 ) println (squares.receive()) // print first five
212
+ repeat(5 ) {
213
+ println (squares.receive()) // print first five
214
+ }
213
215
println (" Done!" ) // we are done
214
216
coroutineContext.cancelChildren() // cancel children coroutines
215
217
// sampleEnd
@@ -297,7 +299,7 @@ import kotlinx.coroutines.channels.*
297
299
fun main () = runBlocking {
298
300
// sampleStart
299
301
var cur = numbersFrom(2 )
300
- for (i in 1 .. 10 ) {
302
+ repeat( 10 ) {
301
303
val prime = cur.receive()
302
304
println (prime)
303
305
cur = filter(cur, prime)
Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ import kotlinx.coroutines.channels.*
11
11
fun main () = runBlocking {
12
12
val numbers = produceNumbers() // produces integers from 1 and on
13
13
val squares = square(numbers) // squares integers
14
- for (i in 1 .. 5 ) println (squares.receive()) // print first five
14
+ repeat(5 ) {
15
+ println (squares.receive()) // print first five
16
+ }
15
17
println (" Done!" ) // we are done
16
18
coroutineContext.cancelChildren() // cancel children coroutines
17
19
}
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import kotlinx.coroutines.channels.*
10
10
11
11
fun main () = runBlocking {
12
12
var cur = numbersFrom(2 )
13
- for (i in 1 .. 10 ) {
13
+ repeat( 10 ) {
14
14
val prime = cur.receive()
15
15
println (prime)
16
16
cur = filter(cur, prime)
You can’t perform that action at this time.
0 commit comments