Objects in ArrayList<CustomObject> array A are unsorted:
ID: [6, 3, 2, 5, 4, 1]
From another part of a program I received array B. Need to sort objects in array A by property int ID in the way array B is sorted:
[3, 6, 4, 5, 1, 2]
So array A should be finally sorted like:
[3, 6, 4, 5, 1, 2]
So the objects in array A are sorted by ID exactly like items in array B are.
What would be the best way to implement it?