I want to print at a time of ArrayList.
Before:
class ExampleUnitTest {
@Test
fun test(){
val stringArray = arrayOf("10", "20", "30", "40", "30", "20", "10", "5", "20", "30", "20", "30").map { it }
println(stringArray.toString())
}
}
# output is :
[10, 20, 30, 40, 30, 20, 10, 5, 20, 30, 20, 30]
After:
# I Want to output Like this :
10, 20, 30, 40, 30, 20, 10, 5, 20, 30, 20, 30
How can I do this coding by Reactivex Java(RxJava)
# something like... e.g..
Observable ...{
... ...
}.subscribeOn(Schedulers.io())
.subscribe({
... ...
})
i got finished the problem by my self!
val sample = listOf("a","b","c","d","e","f","g")
Observable.fromIterable(sample.withIndex())
.subscribeOn(Schedulers.io())
.subscribe({ (index, item) ->
print(if(sample.size > index) item else "$item, ")
println()
},
{ e -> e.printStackTrace() },
{ println("finished!") }
)