i have an array list of arraylists of object type trying to get the size of a specific array list but i keep getting the size of the the whole arraylist
healthyKoalas = new ArrayList<Koala>();
hKoalas = new ArrayList<ArrayList<Koala>>();
public void hkoala(int x)
{
for (int i=0; i<x; i++) // x is the number of healthy koalas in an observation point
{
int age = (int)(Math.random()*18)+1;
Koala k = new Koala(age);
addHKoala(k);
healthyKoalas.sort(Comparator.comparing(Koala::getAge).reversed());
//Collections.sort(healthyKoalas, Collections.reverseOrder());
}
hKoalas.add(healthyKoalas);
}
then when i try
hKoalas.get(x).size();
it gives me the number of all the koala objects while i want to get the size of a specific inner arraylist