wood burning stoves*
The moose likes Java in General and the fly likes Unchecked cast from Object to searilizable ArrayList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Unchecked cast from Object to searilizable ArrayList" Watch "Unchecked cast from Object to searilizable ArrayList" New topic
Author

Unchecked cast from Object to searilizable ArrayList

Abhay Ram
Greenhorn

Joined: Dec 14, 2010
Posts: 7
Hi everybody i want to do like below but it shows the following warning .

Type safety: Unchecked cast from Object to
ArrayList<OfficeOfferLetter>


Code:

ArrayList<OfficeOfferLetter> allletters=new ArrayList<OfficeOfferLetter>();
allletters=(ArrayList<OfficeOfferLetter>) request.getAttribute("offerletters"):
[/code]
In the above code OfficeOfferLetter is the serealizable Bean Arraylist;

& request.getAttribute("offerletters") return the object thats why it shows above warning.

so please suggest any solution ...

thank you
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3068
    
  33

This FAQ will be helpful.


Mohamed Sanaulla | My Blog
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Unchecked cast from Object to searilizable ArrayList
 
Similar Threads
Unchecked cast
Type safety: Unchecked cast from Object to ArrayList
warning Type Safety while assign from object to serealizable Arralist
generics compiler warning
generic collection - avoid unchecked cast?