Dangerous cast, better solution
int i = 0;
for (ComputeTask task : readyTasks) {
...
++i;
}