My ex colleague once told me, if you need to delete some element of a list or array based on some condition, iterate though the list backward. That way, the index will remain the same while traversing the list. Never been in that situation, I thought.
I was faced with this problem recently and thinking about how to solve it, it seems not so straight forward. Then I remembered that advice. Problem solved, yay.
Thursday, October 18, 2007
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment