File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

null values of collections

 
natarajan meghanathan
Ranch Hand
Posts: 130
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone say how many null values are allowed in the following collections:
(1) ArrayList
(2) TreeMap
(3) LinkedList
(4) HashSet
(5) HashMap
I know hashtable does not allow any null values. The API does not clearly say this. It just says ArrayList, etc. allow values including null.
TIA.
 
Val Dra
Ranch Hand
Posts: 439
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(1) ArrayList
(2) TreeMap
(3) LinkedList
(4) HashSet
(5) HashMap
All of them allow null values. Try it. The only thing is in a set values must be unique. SO if you add another null the value will not be added or it will be removed and a new null value be added i don't remember.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic