In my application I have 2 arraylists. One coming from server and another from assets. I want to sort server arraylist based on order of asset arraylist in Kotlin. e.g. val serverArraylist= { “xyz”, “abc”, “pqr”} val assetsList = { “abc”, “pqr”, “xyz”}
Expected output should be, serverArraylist = { “abc”, “pqr”, “xyz”}
Both the list may not always contain same number of elements. Sometimes serverlist may contain fewer elements But will not contain elements other than local list. Like, serverList= {xyz, pqr} Then expected list should be, severList= {pqr, xyz}
Any help or idea highly appreciated. Thanks in advance.