Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: correct use of TreeSet

Reply
Thread Tools

Re: correct use of TreeSet

 
 
Stefan Ram
Guest
Posts: n/a
 
      02-26-2006
Luc wrote:
>I have a LinkedList of File objects and want to sort them by
>size to find duplicates.


They should implement

http://download.java.net/jdk6/docs/a...omparable.html

appropriately, then you can use

http://download.java.net/jdk6/docs/a...java.util.List)


 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      02-26-2006
On 26 Feb 2006 00:24:58 GMT, http://www.velocityreviews.com/forums/(E-Mail Removed)-berlin.de (Stefan Ram)
wrote, quoted or indirectly quoted someone who said :

>>I have a LinkedList of File objects and want to sort them by
>>size to find duplicates.

>
> They should implement
>
>http://download.java.net/jdk6/docs/a...omparable.html
>
> appropriately, then you can use
>
>http://download.java.net/jdk6/docs/a...java.util.List)
>


for an memory-efficient implementation of that, see the MiniFD and FD
classes in the Replicator source. FD = File Descriptor.

see http://mindprod.com/products1.html#REPLICATOR
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
Reply With Quote
 
 
 
 
Stefan Schulz
Guest
Posts: n/a
 
      02-26-2006
Since these are java.io.File objects (As far as i understand the OP),
you should implement a Comparator that compares files by size, and
stick that to Collections.sort()

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TreeSet bug? jacksu Java 2 06-15-2006 09:47 PM
Why would an add() in a TreeSet subclass fail? Rhino Java 17 02-24-2005 05:09 AM
TreeSet size() Problem Rhino Java 2 02-22-2005 04:49 PM
Re: JList customized with TreeSet Sandip Chitale Java 0 08-23-2003 09:44 PM
How to use TreeMap, TreeSet, etc? Mark Wayne Javascript 1 07-16-2003 06:32 PM



Advertisments