So I have this code:
for(Runnable loadTask : mMeshLoadMap.values())
{
if(loadTask != null)
{
loadTask.run();
loadTask = null;
}
}
My problem is the loadTask = null statement is never executed, Android Studio says "The value "null" assigned to loadTask is never used"...
Plus when I set a breakpoint at that line the debugger never reaches it.
It can reach loadTask.run() but not loadTask = null
And I am sure that loadTask.run() doesn't block soo long
It certainly can be assigned, but it is pointless. You'd only be nulling the reference named loadTask (which is out of scope outside the block). You cannot update the reference in the array. The For-Each Loop says (in part)
The for-each loop hides the iterator, so you cannot call remove. Therefore, the for-each loop is not usable for filtering. Similarly it is not usable for loops where you need to replace elements in a list or array as you traverse it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With