public Bs[][] update(Bs[][] bs) {
int rows = bs.length;
int cols = bs[0].length;
Bs[][] newTemporaryFoo = new Bs[rows][cols];
for (int row = 0; row < bs.length; row++) {
for (int col = 0; col < bs[row].length; col++) {
bar.updateRowCol(row, col);
int pos = find(row, col);
int count = bar.count(pos);
State state = updateState(bs[row][col], count);
newTemporaryFoo[row][col].change(state);
}
}
I have a method is updating a 2d array of objects (bs) by creating a new temporary 2d array, checks the state of the original one, updates the new state to the temporary 2d array and returns it.
The loops over the 2d array of objects and in the loop I have one method call from another class (bar) followed by two other private method calls.
I understand I could use ArgumentCaptor to catch the argument in bar.updateThings and pass those values to find but I don't understand how I can do it when both the values are in a loop since as far as I understand the values in the ArgumentCaptor would only be available after the loop finishes and by that time invocations of the other methods have already been performed.