Thursday 8 August 2013

In Java how do you sort one list based on another?

In Java how do you sort one list based on another?

I've seen several other questions similiar to this one but I haven't
really been able to find anything that resolves my problem.
My use case is this: user has a list of items initially (listA). They
reorder the items and want to persist that order (listB), however, due to
restrictions I'm unable persist the order on the backend so I have to sort
listA after I retrieve it.
So basically, I have 2 ArrayLists (listA and listB). One with the specific
order the lists should be in (listB) and the other has the list of items
(listA). I want to sort listA based on listB.

No comments:

Post a Comment