package Ġnam nh . clean . domain . inter actor . input port Ċ Ċ import Ġio . reactivex . Maybe Ċ import Ġnam nh . clean . domain . executor . Post Execution Thread Ċ import Ġnam nh . clean . domain . executor . Thread Executor Ċ import Ġnam nh . clean . domain . inter actor . output port . Maybe Observer Ċ Ċ abstract Ġclass ĠMaybe UseCase < in ĠInput , ĠT >( ĊĠĠĠ Ġthread Executor : ĠThread Executor , ĊĠĠĠ Ġpost Execution Thread : ĠPost Execution Thread Ċ ) Ġ: ĠUse Case < Input , ĠMaybe < T >>( thread Executor , Ġpost Execution Thread ) Ġ{ ĊĊĠĠĠ Ġfun Ġexecute ( input : ĠInput , Ġobserver : ĠMaybe Observer < T >) Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġobservable Ġ= Ġbuild UseCase ( input ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. subscribe On ( thread Executor ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. observe On ( post Execution Thread ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. do On Subscribe ( observer . subscribe Consumer ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ. do Finally ( observer . finally ()) ĊĠĠĠĠĠĠĠ Ġadd ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġobservable . subscribe ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġobserver . success Consumer (), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġobserver . error Consumer (), ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġobserver . complete Consumer () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠ Ġ} Ċ } Ċ