on my following code, I have 2 counters so I used an ArrayList , as I want to get number of each counted items outside loop.
I've used arrayList as follow which gives me the expected values at print, but I would like to know if I can optimize my code using array [] , collections instead of list to avoid to to twice list.add(cout1);list.add(count2)?

```
ArrayList<Integer> list = new ArrayList<Integer>();
      int count1 = 0;
      int count2 = 0;

      for (int i = 0; i < nb; i++)
      {

        if (action)
        {
          counter1++;

        }
        if (votherAction)
        {
          counter2++;

        }

      }
    list.add(count1);
    list.add(count2);

```