View Single Post
  #2 (permalink)  
Old 07-30-2007, 08:57 PM
brianhks brianhks is offline
Senior Member
 
Join Date: Jul 2007
Posts: 134
brianhks will become famous soon enough
container.get(i) will return the object at the i position in the array list.

It almost looks like you are wanting to call a method on that object that is returned. To do that you will want to do something like this:
Code:
//Say the array is containing objects of type MyObject ((MyObject)container.get(i)).myMethod();
A better way is to use the new Java types with your containers. Like so
Code:
private ArrayList<MyObject> container = new ArrayList<MyObject>(); public Test() { for( int i = 0; i < container.size(); i++) { //Now you can do things like this container.get(i).myMethod(); //Because the container knows it is holding an object of type MyObject } }
Reply With Quote