Hi,
I am creating an PriorityQueue with multiple queues. I am using an Array to store the multiple ArrayLists that make up my different PriorityQueues. Here is what I have for my constructor so far:
ArrayList<ProcessRecord> pq;
ArrayList[] arrayQ;
MultiList(){
arrayQ = new ArrayList[9];
pq = new ArrayList<ProcessRecord>();
}
The problem comes when I am trying to get the size of the entire array, that is the sum of the sizes of each ArrayList
in the array.
public int getSize(){
int size = 0;
for(int i = 1; i <=9; i++){
size = size + this.arrayQ[i].size();
}
return size;
}
is not seeming to work. Am I declaring the Array of ArrayList
correctly? I keep getting an error saying that this.arrayQ[i].size()
is not a method. (the .size() being the problem)
Thanks for any help!
David