Observable.just(10,20,30,40,50)
.subscribe { Consumer<Int>{
Log.d(TAG, "Where I'm I" + Thread.currentThread())
System.out.println("Hello boss")
Toast.makeText(baseContext.applicationContext, "Hellloo",Toast.LENGTH_SHORT).show()
} }
vs
Observable.just(10,20,30,40,50)
.subscribe( { Consumer<Int>{
Log.d(TAG, "Where I'm I" + Thread.currentThread())
System.out.println("Hello boss")
Toast.makeText(baseContext.applicationContext, "Hellloo",Toast.LENGTH_SHORT).show()
} })
调用subscribe({}) vs subscribe { }
有什么区别>>
Observable.just(10,20,30,40,50).subscribe {消费者
关于RxJava
没有区别。调用和执行保持不变。它只是kotlin
中的一种特殊语法,称为trailing lambda
。