does anyone have any suggestions for how to handle...
# getting-started
d
does anyone have any suggestions for how to handle comparing 2 similar(but not exact) lists. I want to compare the objects in list(generally in same position in either list) A by
key
against list B, and then by a
version
. If value in list B is higher than list A, I want to replace list A with item from list B. I think
compareValuesBy
might work but I’m having trouble sorting out how to implement it fully because elements might be slightly different so I’ll need to scan the list to verify if it’s not found
n
do both lists have the same number of elements? if yes, i’ll start with
zip
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/zip.html then you can do whatever you want with the pairs
d
no they won’t reliably, items will be added/removed from List B, it’s performing an API call that’s then comparing to List A to update it in place