This week's book giveaway is in the HTML/CSS/JavaScript forum.
We're giving away four copies of Practical SVG and have Chris Coyier on-line!
See this thread for details.
Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Building a treeset of files, with not much success yet

 
Yotam Ohayon
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there
i am trying to implement a TreeSet containing all files/sub folders in the run-time folder.
i want the objects (FILE objects) to be sorted by name. here's what i have:

notice: comp is of type ABS, that's a class implementing Comparator and it sorts files by their name.
i have 5 different files and two sub folders (src and bin) in the run-time folder but it only gets one file (tester) and one folder(src). the others are ignored.


any suggestions?
this is my first time working with a TreeSet, the java tutorial on it is not very informative in my opinion
thanks!
 
Stephan van Hulst
Bartender
Posts: 6587
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without seeing ABS, there's not much we can say about the problem.

Note that File implements Comparable. Read what Comparable does, and what TreeSet does if you don't pass any arguments to its constructor.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!