This is probably not important, but a while loop would be much faster here. This would likely only be a problem if the dependency list was very long or many RDDs were being cleaned up simultaneously (an ML or streaming program, perhaps). Feel free to not change this if you feel that the code change is not worth the performance benefit here.