I want to have a look at how Java implements LinkedList. Where should I go to look at the source code?
Install the Java SE Development Kit from http://java.sun.com/javase/downloads/index.jsp.
Once installed, you should find an archive called src.zip
in the top of the JDK installation directory. The Java source code is in there.
The file is java/util/LinkedList.java
.
I would say start at the OpenJDK repository, but I don't see anything there for the LinkedList objects.
I got it finally. Here is the direct link: http://www.java.net/download/jdk6/6u3/promoted/b05/jdk-6u3-fcs-src-b05-jrl-24_sep_2007.jar
You have the source in the docjar:
LinkedList.java (from the openjdk-7)
As previously said, you have a src.zip file installed with Sun JDK if you have selected it during installation. Moreover, if you use eclipse and add a JDK to your JRE list, it will attach automatically the sources to the jar and if you try to open a class with Ctrl+Shift+T (Open Type), you type LinkedList, and it will show you the code of the class.
The JDK source code can be browsed online:
https://jdk-jrl-sources.dev.java.net
First you will need to register for a http://java.net account and apply for a Researcher project role on the JDK project:
https://jdk.dev.java.net/#started
You will receive an email when the role has been granted. Looking up the source code in Eclipse is certainly easier, but the online source repository can be useful when you don't already have the source code downloaded.
Also, it seems that some code (such as the native C code used to implement the AWT library) is available only in this repository and not included in the source code JAR file bundled with the JDK.
If you have a JDK, you can find the source in the src.zip file.
If you have an IDE, you can just <ctrl>+<click> or similar on the class/method you want to see the definition of.