• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generics question--Bit complicated??

 
prashanth kumar
Ranch Hand
Posts: 162
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I have this question regarding generics.
Can anybody explain me why the options 4 and 6[i know abt this option]are correct?

Many Thanks

 
Keith Lynn
Ranch Hand
Posts: 2399
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Option 4 is correct because if you removed lines 2 and 3, you are just adding a new entry to the map containing a String for key, and ArrayList for value.

Option 6 will work because there is no requirement in a general map that the keys be mutually Comparable.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic