|
Aaron, what Jeff is showing you will almost certainly work and be better than a hand coded bubble sort. The Collections framework included with JDKs 1.2+ gives much better sort implementations. You should look at your data in a Collection/Map/List/etc. and code to the interface and use the best implementation for your use case. If no implementation fits, you may need to create your own but that would be very rare. Decide whether null keys or duplicates are possible. Also look at whether you need to optimize to access or update. Determine if your access needs to be synchronized. One book that might help you make these decisions is called Essential Java Style. It is a little out of date (1999) but covers this area pretty well. Here is a link to another way of using Comparator in an anonymous inner class to sort an ArrayList: http://www.midrangeserver.com/guruo/mgo101602-story01.html David Morris >>> ALBartell@xxxxxxxxxxxxxx 2/17/2004 10:09:40 AM >>> You really need to adopt the OO approach and define your IRGPerf class to implement the Comparator interface.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.