I want to ask about arraylist rearrange
If I have 2 arraylist like this
ArrayList<A> listA;
ArrayList<B> listB;
And if I rearrange listA like this
private static class Descending implements Comparator<A> {
@Override
public int compare(A arrayListA, A t1) {
return t1.getLasttime().compareTo(arrayListA.getLasttime());
}
}
private void setListTimeSort(ArrayList<A> arrayListA) {
Descending descending = new Descending();
Collections.sort(arrayListA, descending);
}
I want to change position together listB.
simple example:
listA before = 1, 2, 3, 4
listB before = a, b, c, d
If listA change = 2, 1, 4, 3, I want to listB change same position item = b, a, d, c.
I changed listA, but I don't know how I can change listB (change position like listA).