[Solved] Iterate through a possibly infinite amount of nested ArrayLists


You can create a recursive function,

public void loopThrough(List<Region> regions) {
    for(Region region : regions) {
        if(region.hasSubRegion()) { 
            loopThrough(region.getSubRegions());
        }
    }
}

1

solved Iterate through a possibly infinite amount of nested ArrayLists