I have a class with 2 property
class SelectedAmount : Serializable {
lateinit var amount: List<Int> //the values here is coming from backend in array list. eg [50,100,150,200]
var isSelect: Boolean = false
}
I want to pair each amount with a boolean value. eg [{50, true}, {100, false}, {150, false}, {200, false}]
In view activity i did
private var amountList: MutableList<AmountSelected> = ArrayList<AmountSelected>()
val amountInterval = data.reloadDenoms // BE value {50,100,150,200}
if (amountInterval != null) {
for (items in amountInterval) {
var amountSelected:SelectedAmount = SelectedAmount()
amountSelected.amount = amountInterval
amountSelected.isSelect = false // tring to set boolean false for every amountInterval value
amountList.add(amountSelected)
}
when i tring to print the value of amountList .. i get out put as
[{50,100,150,200}, false]
my expected output is
[{50, true}, {100, false}, {150, false}, {200, false}]
can anyone help me on this? I am a newbie here learning array btw