How to bubble sort a arraylist in java?
i want to bubble sort an arraylist. or is there a better way to sort an arraylist or list.
-
Bubblesort is a slow algorithm... but it's ok for learning purposes :)irrelephant– irrelephant2011-01-07 08:30:53 +00:00Commented Jan 7, 2011 at 8:30
-
Why not go straight to bogosort? Propably useful for learning, too ;)user395760– user3957602011-01-07 08:31:47 +00:00Commented Jan 7, 2011 at 8:31
Add a comment
|
2 Answers
is there a better way to sort an arraylist or list.
Yes: use the sorting that is built into the standard library.
For example, http://download.oracle.com/javase/1.4.2/docs/api/java/util/Collections.html#sort%28java.util.List%29