• Post Reply Bookmark Topic Watch Topic
  • New Topic

Finding the right import statement  RSS feed

 
N Sam
Ranch Hand
Posts: 77
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Often times i don't remember which package a specific class (like ArrayList) belongs to. Is there an easy way to find that java.util.* is what i need to import, if i wanted to use the class ArrayList ? I am sure this gets into memory over time, but as a beginner, i wonder if there is any oracle online doc (or something else online) that will help me find the right package for a given class.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The javadoc is what you seek.
 
Robert D. Smith
Ranch Hand
Posts: 221
5
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:The javadoc is what you seek.

This. Also I have found that simply googling 'java arraylist' works very well, generally taking me right to the javadocs page I need.

Regards,
Robert
 
Raghavan Muthu
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using an IDE like Eclipse, you can press Ctrl + Shift + T (for Type References) which will give you a text box to search the class you want. Right below, it will show the matching classes with their fully qualified package names . I think all the IDEs might have this feature except that the short cut key OR the way to invoke may vary!

Hint: You can also do a wild card search like '*List', '*Hash*' etc., if you are not really sure on the terms the class names begin/end with. It is more like a file search in your Windows OS.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!