ArrayList of ArrayLists (dynamic 2D array) of custom class

Usually if i have to deal with copies, ill use something which can store an object usually an arraylist. I use one for the original and a second one for all copies.

Then i iterate through the first arraylist and based on the conditions im looking for ill code an appropriate logic statement and set an index object in the second arraylist or empty the arraylist and add the desired object.

Not necessarily as direct as in other languages but it works.

Im sure there might be better ways though.