Sorting a list based on another list's values - Java

后端 未结 5 971
梦如初夏
梦如初夏 2020-12-10 18:58

One list with names:(unsorted) e.g [paul, foul, mark]

Another list with integers: e.g [5, 2, 6]

The values on the secon

5条回答
  •  再見小時候
    2020-12-10 19:24

    Get rid of the two Lists. If the data is related then the data should be stored together in a simple class. Then the entire class is added to a list where you can sort on the individual properties if required. You can use a Bean Comparator to sort this List however you desire.

提交回复
热议问题