And? If your objects are immovable then one level of indirection (pointers or indices) solves that. If your objects are moveable, then there's many (!) times where having your container sorted will improve performance.
2. Have another container named `indices` representing the index or iterator into your Persons container
In C++:
3. `std::sort(begin(indices), end(indices), [&](int lhs, int rhs)->bool{ return persons[lhs].age() < persons[rhs].age(); });`
I don't know Java but I am sure there are many ways to do it in Java.
It's quite hard to come up with something that we could use in every day programming that will benefit from the new optimizations.
I.e.: [ a, b, c ].map(hash) produces the same order.
where hash: A -> B, where p, q in A. p < q => x, y in B. x < y.
It's not that hard, in many cases, to find an `f : DataDomain -> Int` st. `f(x1) < f(x2)` where `hash(x1) < hash(x2)`