sorting arraylist based on another arraylist
how can i sort 2 arraylist but only using 1 of them as criteria.
Like if I have arraylists and want to sort it based on the integers of x in ascending order.
I need to sort it so the arraylists become
so arraylist y is sorted according to x's ascending status, (meaning that all changes of x are transferred to y, so if for example x's 3rd element is moved to first position, y's 3rd element is moved to 1st as well, regardless of y's element's size.