Could anybody give me an example of this in Java?
public void foo(ArrayList<Object> arrList){
//Insert Code Here
}
Could I see an example of how the method takes the data from the object that is in the array and a loop that cycles through the array selecting different objects?
Let me also add that these objects have a boolean value as well as a double value.
The objects with the boolean and double value should have a method that returns the boolean/double values.
Notice how I called the passed ArrayList 'arrList.' Like normal arrays, ArrayLists are passed by reference (all parameters in java are actually passed by value, but for the purposes of explaining, it is easier to see it as passed by reference). So if you modify anything in the ArrayList while inside the method, you are actually modifying the real ArrayList that was created outside of the method. Just something to keep in mind.
Now to answer how to use it in the method:
Say you wanted to print all boolean and double values of all objects in the ArrayList.
public void printValues(ArrayList<Object> arrList){
for(int i = 0; i < arrList.size(); i++){
Object j = arrList.get(i);
System.out.println(j.getBoolean() + " " + j.getDouble());
}
}
You need to replace Object with the data type that you are using.