Generic container for sortable elements.
Wraps generic elements inside it and is built up an index that
is used to apply sorting algorithms.
Example:
// This example applies sorting on Tuple
elements
TreeSet
<SortableElement<?>> sortingTable = new TreeSet<SortableElement<?>>();
sortingTable.add(new SortableElement<Tuple<String>>(3, new Tuple<String>("Hello", "My element")));
sortingTable.add(new SortableElement<Tuple<String>>(1, new Tuple<String>("I am an element", "My element")));
sortingTable.add(new SortableElement<Tuple<String>>(2, new Tuple<String>("I am an element too", "My third element")));
sortingTable.add(new SortableElement<Tuple<String>>(0, new Tuple<String>("I should be the first", "My first element")));
sortingTable.add(new SortableElement<Tuple<String>>(7, new Tuple<String>("I should be the last", "Name", "surname")));
Other usages (on demand sorting):
List
<SortableElement> sortableList = new Vector<SortableElement>();
Collections.sort(java.util.List<T>)
(sortableList);