How to get average of last 5 value using groupby arraylist in kotlin
I am trying to group by arraylist and get average of last 5 items. please anyone suggest me i am stuck here
I done so far is this
aproxXInfos.groupBy { it.mac }
.map { group ->
val beaconMac = group.key
val beaconAllValues = group.value
val averageRssi = beaconAllValues.sumBy { it.rssi } / beaconAllValues.size
println("Average rssi for beacon $beaconMac is $averageRssi")
}
this is...