Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Finding "Collections and Generics" chapter difficult to grasp in scjp 6 study guide..

 
achuthan mukundarajan
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am finding collections and generics topic hard to follow from reading SCJP 6 guide in kathy sierra guide. Can anyone suggest a basic book for this topic?...(I have head first java but that too is not so good as to clear the basics).
 
Paweł Baczyński
Bartender
Posts: 1745
31
Firefox Browser IntelliJ IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I didn't find it hard to read. Maybe you have a specific question about something that confuses you and I might help ;) ?
 
Himai Minh
Ranch Hand
Posts: 1229
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In terms of generics, for the purpose of the exam, ask yourself if you understand these:
1 .ArrayList<String> , ArrayList<?> alist = new ArrayList<String> , ArrayList<? extends Number> numbers = new ArrayList<Integer> , ArrayList<? super Integer> numbers = new ArrayList< Object>,
2. If you have ArrayList<? extends Number> alist = ..., can you do this alist.add(...) ? No.
3. If you have ArrayList<? super Integer> alist = ... , can you do this alist.add(new Integer(10)) ? Yes. How about alist.add(new Object())? No.

Make sure you understand the basics of how generics are applied to collections.
For any questions, let us know.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic