Re: correct use of TreeSet

Discussion in 'Java' started by Stefan Ram, Feb 26, 2006.

  1. Stefan Ram

    Stefan Ram Guest

    Stefan Ram, Feb 26, 2006
    #1
    1. Advertising

  2. Stefan Ram

    Roedy Green Guest

    On 26 Feb 2006 00:24:58 GMT, -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/api/java/lang/Comparable.html
    >
    > appropriately, then you can use
    >
    >http://download.java.net/jdk6/docs/api/java/util/Collections.html#sort(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.
     
    Roedy Green, Feb 26, 2006
    #2
    1. Advertising

  3. 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()
     
    Stefan Schulz, Feb 26, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sandip Chitale

    Re: JList customized with TreeSet

    Sandip Chitale, Aug 23, 2003, in forum: Java
    Replies:
    0
    Views:
    664
    Sandip Chitale
    Aug 23, 2003
  2. Rhino

    TreeSet size() Problem

    Rhino, Feb 21, 2005, in forum: Java
    Replies:
    2
    Views:
    666
    Anton Spaans
    Feb 22, 2005
  3. Rhino
    Replies:
    17
    Views:
    1,044
    Rhino
    Feb 24, 2005
  4. jacksu

    TreeSet bug?

    jacksu, Jun 15, 2006, in forum: Java
    Replies:
    2
    Views:
    1,242
    jacksu
    Jun 15, 2006
  5. Mark Wayne

    How to use TreeMap, TreeSet, etc?

    Mark Wayne, Jul 15, 2003, in forum: Javascript
    Replies:
    1
    Views:
    223
    Grant Wagner
    Jul 16, 2003
Loading...

Share This Page