Re: Trouble with ArrayList
- From: "Doug Pardee" <dougpardee@xxxxxxxxx>
- Date: 28 Nov 2006 08:24:21 -0800
Lawrence wrote:
Item getitem = items.get(0);
You need to cast the returned object to the expected type:
Item getitem = (Item) items.get(0);
Alternatively, if you're using Java 5.0 you could do it with generics:
private ArrayList<Item> items;
items = new ArrayList<Item>();
items.add(item);
Item getitem = items.get(0);
.
- References:
- Trouble with ArrayList
- From: Lawrence
- Trouble with ArrayList
- Prev by Date: Re: Trouble with ArrayList
- Next by Date: wrong jai for Windows from Mac NetBeans build?
- Previous by thread: Re: Trouble with ArrayList
- Next by thread: Re: Trouble with ArrayList
- Index(es):