Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning RxJava

You're reading from   Learning RxJava Reactive, Concurrent, and responsive applications

Arrow left icon
Product type Paperback
Published in Jun 2017
Publisher Packt
ISBN-13 9781787120426
Length 400 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Thomas Nield Thomas Nield
Author Profile Icon Thomas Nield
Thomas Nield
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Thinking Reactively FREE CHAPTER 2. Observables and Subscribers 3. Basic Operators 4. Combining Observables 5. Multicasting, Replaying, and Caching 6. Concurrency and Parallelization 7. Switching, Throttling, Windowing, and Buffering 8. Flowables and Backpressure 9. Transformers and Custom Operators 10. Testing and Debugging 11. RxJava on Android 12. Using RxJava for Kotlin New Appendix

Dealing with SAM ambiguity

At the time of writing this, there is a nuance when Kotlin invokes Java libraries with functional parameters. This problem especially rears its head in RxJava 2.0 when many parameter overloads are introduced. Kotlin does not have this issue when invoking Kotlin libraries but it does with Java libraries. When there are multiple argument overloads for different functional SAM types on a given Java method, Kotlin gets lost in its inference and needs help. Until JetBrains resolves this issue, you will need to work around this either by being explicit or using RxKotlin's helpers.

Here is a notorious example: The zip() operator. Try to do a simple zip here and you will get a compile error due to failed inference:

 

import io.reactivex.Observable

fun main(args: Array<String>) {

val strings = Observable.just("Alpha", "Beta&quot...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image