Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to caste hashmap to linkedhashmap?

890683Oct 26 2011 — edited Oct 26 2011
Hi,

I am getting values from webservices and the webservice method returns LinkedHashmap but I am getting it has hashmap in my program(no idea why it is coming as hashmap instead of linkedhashmap). So when i tried to cast this hashmap into Linkedhashmap, it is throwing the following exception.

Exception in thread "main" java.lang.ClassCastException: java.util.HashMap cannot be cast to java.util.LinkedHashMap

Please help.

Regards,
Raj
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 23 2011
Added on Oct 26 2011
8 comments
3,861 views