File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading the API (aka RTFM)

 
Zach Burnham
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was just working with an ArrayList in a project I'm trying to complete, and found that ArrayList itself doesn't have a .sort() method. In the course of asking around, I found that Collections.sort(myArrayList) will work, but I have another issue I'd like some help with.

How the(#&$ would I have been able to figure that out from reading the API documentation? I've gone through the interfaces, subclasses, superclasses, etc of ArrayList and nowhere do I find a reference to the static methods available in Collections. Someone want to donate a clue to me? I'd really rather be able to look up answers myself
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's hard to get the big picture just by looking at the methods of a class. One clue might have been the link at the bottom of the class description "This class is a member of the Java Collections Framework", which will lead you to another page describing the collections package. Once there, either the Overview or the Tutorial page would have talked about sorting. But rest assured that I didn't know this either, until I looked it up just now.
[ March 15, 2006: Message edited by: Ulf Dittmer ]
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java Almanac is an invaluable resource for the beginning programmer. 1000's of searchable examples covering the whole API. For example, your plight with sorting. Type "sort" into the box marked "Search for Code Examples" and the second hit is what you were looking for. When that fails, there's always Google and JavaRanch.
 
Zach Burnham
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info. I'd been to the almanac before but wasn't making the connection today... java makes my brain tired
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic