highest

How to compare data in session with PHP?

The $_SESSION has the following data array. Array ( [totalprice] => 954 [cart] => Array ( [115] => Array ( [name] => MÅNESKINN [price] => 268.00 [count] => 1 ) [80] => Array ( [name] => DELFINLEK [price] => 268.00 [count] => 1 ) [68] => Array ( [name] => OPPDAGELSEN [price] => 418....

Extracting a given number of the highest values in a List

I'm seeking to display a fixed number of items on a web page according to their respective weight (represented by an Integer). The List where these items are found can be of virtually any size. The first solution that comes to mind is to do a Collections.sort() and to get the items one by one by going through the List. Is there a more e...