I have a nested list as shown below (but it contains 1000 lists holderin one main list). Let's say I need to sort the main list listEmailDataby value for each of its lists holderin the index holder.get(2). It seems I can’t figure out how to do this, any advice is appreciated.
ArrayList listEmailData;
ArrayList holder = new ArrayList();
listEmailData.add(3)
listEmailData.add(323)
listEmailData.add(2342)
listEmailData.add(holder)
EDIT: To clarify, I have a list in which each list entry contains a sub-list, in this sub-list a specific index contains a value that is a ranking. I need to sort the main list based on this ranking value in each sub-list.
2ND EDIT: Thanks for helping me with this, it made it work, but it seems that it puts large numbers ahead and large numbers later, I was hoping to reverse this, so it goes from the largest to the smallest like me.
source
share