ArrayList.get help ?



Hi,
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"
Now the ArrayList.get(int i) returns a reference to the object at that
position, so I thought that reference could be used to directly refer to
that object.
I want currentTool to contain a copy of the Tool object in that position in
the list, so I can test that copy. Or even better I want to
directly run a method on the object referenced in that list position without
copying the object.
Can someone point in the right direction to get the syntax for this ?
Tony


.