When doing some actions with agents of some population, you may need to sort them by some value. There is no need in rearranging agents within a population, you can use the following AnyLogic functions to get the ordered list, and then work with it in your code.
List sortedByAgeAsc = sortAscending( people, p -> p.age ));
List sortedByIncomeDesc = sortDescending( people, p -> p.income ));
How can we improve this article?