package Ġcom . z 8 0 h 3 x . ke zd _ kov . ui . initi ative _ list Ċ Ċ import Ġco . zs mb . rain bow cake . base . Rain bow Cake ViewModel Ċ import Ġcom . z 8 0 h 3 x . ke zd _ kov . data . generic . Base Character Ċ import Ġjavax . inject . Inject Ċ Ċ class ĠInit List ViewModel Ġ@ Inject Ġconstructor ( ĊĠĠĠ Ġprivate Ġval Ġinit List Presenter : ĠInit List Presenter Ċ ) Ġ: ĠR ain bow Cake ViewModel < Init ListView State >( Loading ) Ġ{ ĊĊĠĠĠ Ġfun Ġload ( order Descending : ĠBoolean ) Ġ= Ġexecute Ġ{ ĊĠĠĠĠĠĠĠ Ġview State Ġ= ĠLoading ĊĠĠĠĠĠĠĠ Ġval Ġsorted List Ġ= Ġif Ġ( order Descending ) Ġinit List Presenter . get Characters (). sorted With ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcompare By < Base Character > Ġ{ Ġit . initi ative Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. then By Ġ{ Ġit . modifier Ġ} ĊĠĠĠĠĠĠĠ Ġ). reversed () ĊĠĠĠĠĠĠĠ Ġelse Ġinit List Presenter . get Characters (). sorted With ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcompare By < Base Character > Ġ{ Ġit . initi ative Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. then By Ġ{ Ġit . modifier Ġ} ĊĠĠĠĠĠĠĠ Ġ) ĊĠĠĠĠĠĠĠ Ġview State Ġ= ĠInit List Ready ( sort edList ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġdelete Character ( character : ĠBase Character , Ġsort Descending : ĠBoolean ) Ġ= Ġexecute Ġ{ ĊĠĠĠĠĠĠĠ Ġinit List Presenter . delete Character ( character ) ĊĠĠĠĠĠĠĠ Ġload ( sort Descending ) ĊĠĠĠ Ġ} Ċ } Ċ