As nothing’s as straight forward as PHP, I had to write my own class to sort ArrayCollections. My work was inspired by what Peter Dehaan did.
The method is to be used as follows:
ArrayUtils.sort(games, "playerScore", "DESC", true);
to sort an ArrayCollection of games by player score, with a de ...
It may be necessary to sort a dataset after a SQL request. And in a general case, I prefer using this function instead of dealing with the ORDER BY and LIMIT clauses.
So I wrote this method (which is part of my Utils class, in my own framework):
(more…)
...