for (ComputeTask task : generatedTasks) should work just fine