HashMap & ArrayList
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   madhavan_srinivasan
Posted On:   Monday, June 11, 2001 10:44 AM

Friends

Here's my Q.

HashMap h1;
HashMap h2;



h1 contains some hashmap elements & those elements contains arraylist elements.

I tried to retrieve hashmap elements of h1.

ie.

h2=(HashMap)h1.get(index);

(If h1 contains some elements which has null values, i'm gettin
"java.lang.ClassCastException".)

Is there any way to detect the null value of those elements?

Thanks
M.

Re: HashMap & ArrayList

Posted By:   John_Mitchell  
Posted On:   Sunday, June 17, 2001 03:06 PM

Um, er, get the hashmap returned reference value into an plain Object reference first and test it against null rather than blindly trying to cast it?
About | Sitemap | Contact