package Ġcommon s . android . rx Ċ Ċ import Ġandroid . support . v 7 . util . Diff Util Ċ import Ġandroid . support . v 7 . widget . RecyclerView Ċ import Ġio . reactivex . Single Ċ import Ġio . reactivex . android . schedul ers . Android Schedulers Ċ import Ġio . reactivex . schedul ers . Schedulers Ċ Ċ object ĠRx Recycler Util Ġ{ ĊĊĠ Ġ@ Jvm Static ĊĠ Ġfun Ġcalc And Dispatch Diff ( adapter : ĠRecyclerView . Adapter <* >, Ġcallback : Ġ() Ġ-> ĠDiff Util . Callback ) Ġ= ĊĠĠĠ ĠSingle . from Callable Ġ{ ĠDiff Util . calculate Diff ( callback ()) Ġ} ĊĠĠĠĠĠ Ġ. subscribe On ( Schedulers . computation ()) ĊĠĠĠĠĠ Ġ. observe On ( Android Schedulers . main Thread ()) ĊĠĠĠĠĠ Ġ. map Ġ{ Ġdiff Ġ-> Ġdiff . dispatch Updates To ( adapter ) Ġ} Ċ } Ċ