I have a List that contains objects like an adress – e.g. city, street, name.
And always need receive 3 lists: first ordered by city, second ordered by street, third ordered by name. It is clear that possible order consequentially the same list. But it consumes many time.
Is it possible to create something like Iterator that can depend from parameter return all members of collection in corresponding order? Or exists another solution?
Thanks.
Not with the standard java collection framework. What you are asking to work, you have to build different search trees that operate on same collection.
It is like having indices on different columns in DB