pdegand
05/30/2018, 10:17 PMliveData.observe(this, Observer { })
when I can write mediatorLiveData.addSource(liveData) { }
?
In both case, the 2d param of the observe
or addSource
is a android.arch.lifecycle.Observer
and this interface has only 1 method ...
I'm confusedlouiscad
05/30/2018, 10:49 PMrusshwolf
05/31/2018, 3:20 AMMediatorLiveData.addSource
, both the source parameter and the lambda share a generic parameter, while in LiveData.observe
the generic is only on the lambda. I'm guessing this means that the compiler can infer the generic type on the MediatorLiveData
method but not the LiveData
one, so you must use a syntax that specifies it.arekolek
05/31/2018, 6:10 AM2^n
variants for a method that has n
parameters that are eligible for SAM conversion, so instead it generates only two variants: the one where all are lambdas and the one where there are no lambdas