An alternative way to order a List is using the Collections framework;
in this case using the SortedSet (the bean in the list should implement Comparable, so Double is ok):
List<Double> testList;
...
SortedSet<Double> sortedSet= new TreeSet<Double>();
for(Double number: testList) {
sortedSet.add(number);
}
orderedList=new ArrayList(sortedSet);
In general, to order by an attribute of a bean in the list,put all the elements of the list in a SortedMap, using as a key the attribute, then get the values() from the SortedMap (the attribute should implement Comparable):
List<Bean> testList;
...
SortedMap<AttributeType,Bean> sortedMap= new TreeMap<AttributeType, Bean>();
for(Bean bean : testList) {
sortedMap.put(bean.getAttribute(),bean);
}
orderedList=new ArrayList(sortedMap.values());