Wednesday, May 15, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 5374  / 2 Years ago, tue, august 16, 2022, 11:01:33

for Example, lets say i want to use ArrayList so I've to use




import java.util.ArrayList;




in my java source. But in case i forgot that ArrayList is included in java.util package.
so how do i find a package name of ArrayList class ?




  1. assuming i don't have internet

  2. assuming i don't want to browse source


More From » java

 Answers
6

I'm not sure what you use for development, but I'm using IntelliJ IDEA and I never have to care about any import statement. I just start to type ArrL and IDEA will take care of the rest. It will suggest ArrayList<E> for autocompletion and fix the import statement instantly. It just knows what you want to do and you can concentrate on development and not on remembering package names:


enter image description here


Edit:


An easy way to do it in the command-line is to search the src.zip file which comes with the SDK. So if you try to find ArrayList then you can do


7z l src.zip | grep ArrayList

and you get


2013-03-26 21:10:27 ..... 42659 8916 java/util/concurrent/CopyOnWriteArrayList.java
2013-03-26 21:10:27 ..... 21547 5814 java/util/ArrayList.java

where you can see the package structure because it is similar to the sub-folders. I'm sure there are corner-cases where this doesn't work, but you can at least try.


[#21914] Wednesday, August 17, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
repend

Total Points: 195
Total Questions: 113
Total Answers: 107

Location: Nicaragua
Member since Tue, Dec 8, 2020
4 Years ago
;