Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Sort ArrayList by Count

$
0
0
I have an ArrayList of Item objects. Items with the same description are repeated. I want to order it so that it counts all the Item objects that are equal and then order the Items by the groups that have the most to least or vice versa.

So if I have:

Bowl
Bowl
Bowl
Fork
Spoon
Spoon
Knife
Knife
KNife
Knife

It will sort:

Knife
Knife
Knife
Knife
Bowl
Bowl
Bowl
Spoon
Spoon
Fork


I also have to sort the items by their total inventory value...which means their price * count...

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>