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.
Sun Certified Programmer for Java 2 Platform
posted 16 years ago
(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.