• Post Reply Bookmark Topic Watch Topic
  • New Topic

SubList.java source is missing  RSS feed

 
Cs. Robert
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in the AbstractList class there is a method called subList(int fromIndex, int toIndex) which returns java.util.RandomAccessSubList<E> or java.util.SubList<E> references.
My problem is that i cant find the SubList.java and RandomAccessSublist.java sources under my jdk/scr directory.
Why they are missing and how is it possible to recompile the sources if there are missing files?
 
Chandrakant Talele
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The class is right there in the same file (AbstractList.java), just search for "class SubList"
In my jdk1.6.0_16 it is at line 592
 
Campbell Ritchie
Marshal
Posts: 56578
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

The subList() method returns a List. That means the exact implementation details are private, and might change. You can use that method without knowing the implementation details.
The code is not in jdk/scr, but in a file called src.zip inside your Java™ installation directory. You can see the code out of interest, like this:-
  • 1: Copy src.zip to a directory you have write permission in (eg /home or My documents)
  • 2: Unzip it.
  • 3: Open the java folder
  • 4: Open the util folder (note the folder names match the package name)
  • 5: Open the AbstractList.java file with a text editor.
  • Chandrakant Talele has helpfully given you the line number; it is a package-private inner (non-static) class whose instance is being returned. Note there are two versions depending on whether the surrounding object does or does not implement java.util.RandomAccess.
     
    Cs. Robert
    Greenhorn
    Posts: 2
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    ups thanks, i just checked that the SubList class is not an inner class of AbstractList so i thought it would be in a different source file, but i can see now there are more separate classes in the same source file.
    thanks
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!