final AClass[] aggregate = ... ; try { for(i = 0; true; i++) { // do something with aggregate[i] } } catch(ArrayIndexOutOfBoundException e) { }