I have a Collection (unordered) of objects with an id property, and an (ordered) List of ids. The id list is not sorted. I\'d like to crea
Sounds like you have a given order you want, that may or may not be numerically ascending / descending?
I would recommend making your own Predicate below.
org.apache.commons.collections.CollectionUtils.find(java.util.Collection collection,
Predicate predicate);
and loop over your specific ordering finding each actual object in the unordered list. N^2 solution
and a creative use of java.util.collections.sort(List list, Comparator c)
, a org.apache.find(), and java.util.collections.swap(List list, int i, int j)
you may get away from n^2