Philipp Mayer
06/18/2020, 10:24 AMit.receiver
can either be of type ABC or DEF. If its ABC, collect to the first list, if its DEF, collect to the second list
val payments = findOpenPayments.get()
.groupBy { it.receiver == "ABC" }
val somePayments = payments.filter { it.key }.flatMap { it.value }
val otherPayments = payments.filter { !it.key }.flatMap { it.value }
Syam Sundar K
06/18/2020, 10:39 AMval payments = findOpenPayments.get()
.groupBy { it.receiver }
This will result in a HashMap of 2 keys ABC
and DEF
, from which you can obtain the value. Hope this helpsPhilipp Mayer
06/18/2020, 10:47 AMStefan Beyer
06/18/2020, 10:48 AMreceiver
, you can do
val (somePayments, otherPayments) = openPayments
.partition { it.receiver == "ABC" }
Syam Sundar K
06/18/2020, 10:50 AMPhilipp Mayer
06/18/2020, 10:52 AM