Java - Sort ArrayList of Objects based on another array : I want to sort arraylist of object based on another array using Java 7.

List A ={[id:1,name:"A"],[id:2,name:"B"],[id:3,name:"C"],[id:4,name:"D"]}

Array : {2,4}

Output: {[id:2,name:"B"],[id:4,name:"D"],[id:3,name:"C"],[id:1,name:"A"]}

Something similar to the below question but need to implement the same in Java 7(without Lambda)

https://stackoverflow.com/questions/45030842/sort-arraylist-of-objects-based-on-another-array-java