Vishal Hegde wrote: . . . I find difficult in remembering pre defined methods
That is what the API documentation is there for.
...also i am not getting a clearcut idea what TreeSet . . .
You will have to find an algorithms and data structures tutorial or book. You can see what a tree looks like, and draw an example on paper. Try looking for
Niklaus Wirth Data Structures and algorithms book.