Results 1 to 2 of 2
- 11-14-2010, 01:44 PM #1
Member
- Join Date
- Nov 2010
- Posts
- 1
- Rep Power
- 0
-
Are the data elements objects of a class? In other words do you have a class that holds String name and int frequency? If so, make that class implement the Comparable<T> interface, in the compareTo method, return 1, 0, or -1 depending how the frequency of one object compares to the frequency of this object, and then sort the list using Collections.sort(...).
Similar Threads
-
Transfering all items from one List to another
By Bulelakes in forum New To JavaReplies: 6Last Post: 08-23-2010, 08:48 AM -
List of Items in JTextArea
By ŖàΫ ỏƒ Ңόρę in forum New To JavaReplies: 7Last Post: 03-15-2010, 09:03 PM -
[SOLVED] Insertion Sort in Linked List
By taylorp in forum New To JavaReplies: 10Last Post: 03-27-2009, 12:34 AM -
different sort of items
By jrleonard in forum SWT / JFaceReplies: 0Last Post: 12-23-2008, 02:41 PM -
How to sort a list using Bubble sort algorithm
By Java Tip in forum AlgorithmsReplies: 3Last Post: 04-29-2008, 08:04 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks