I’m having an issue with finding some data I have put into my multidimensional arraylist. I basically have an arraylist full of arraylists…
ArrayList<ArrayList<Integer>> array = new ArrayList<ArrayList<Integer>>();
So now I want to use indexOf to find the arraylist that contains specific data because I’m comparing it to other data in the same arraylist.
For example, I know I can use a for loop to find this data —
for (i = 0; i < array.size(); i++)
{
if (array.get(a).get(0) == array.get(i).get(0))
//then do something
}
But I thought it’d be easier to use indexOf or lastindexOf. Does anyone know the correct way I would use it? I’m thinking it’s something like
array.indexOf(array.get(????).get(0))
but I’m not sure 🙁
Unfortunately this is not possible. More than that
is incorrect, since
array.get(????).get(0)would be an Integer andarrayis anArrayListofArrayLists, notIntegers.