Class SortedList<T>

java.lang.Object
aQute.lib.collections.SortedList<T>
Type Parameters:
T -
All Implemented Interfaces:
Iterable<T>, Collection<T>, List<T>, Set<T>, SortedSet<T>

public class SortedList<T> extends Object implements SortedSet<T>, List<T>
An immutable list that sorts objects by their natural order or through a comparator. It has convenient methods/constructors to create it from collections and iterators. Why not maintain the lists in their sorted form? Well, TreeMaps are quite expensive ... I once profiled bnd and was shocked how much memory the Jar class took due to the TreeMaps. I could not easily change it unfortunately. The other reason is that Parameters uses a LinkedHashMap because the preferred order should be the declaration order. However, sometimes you need to sort the keys by name. Last, and most important reason, is that sometimes you do not know what collection you have or it is not available in a sort ordering (MultiMap for example) ... I found myself sorting these things over and over again and decided to just make an immutable SortedList that is easy to slice and dice