Re: ArrayList.get help ?
- From: RedGrittyBrick <RedGrittyBrick@xxxxxxxxxxxxx>
- Date: Sat, 24 Feb 2007 21:14:43 +0000
TonyB wrote:
Further to my earlier questions on ArrayLists, I have now created an ArrayList containing a number of Tool objects, and now I'm trying to do some tests on each list items.
So I find the size of the list, run a for loop, and for each iteration of the loop try to load the object in that position in the list, and then do some tests on that object.
by using something like
private ArrayList toolList ;
private Tool currentTool ;
.....
numberOfElements = toolList.size() ;
for(i=0; i<numberOfElements; i++){
currentTool = toolList.get(i) ;
currentTool.method()
.....
The compiler complains for the line containing toolList.get(i) "incompatible types - found java.lang.Object but expected Tool"
private ArrayList<Tool> toolList ;
.
- References:
- ArrayList.get help ?
- From: TonyB
- ArrayList.get help ?
- Prev by Date: Re: Checking input for letters
- Next by Date: Re: Encoding (continued)
- Previous by thread: Re: ArrayList.get help ?
- Next by thread: Java comm API examples needed
- Index(es):