Skip to content
Advertisement

Tag: immutability

While loop with next() vs foreach

I was going through some third party code and I ran onto this snippet for going through an array. Since this is a respectful code base I’m wandering what is the secret behind the trouble of moving internal pointer versus using the good old foreach loop. Thanks for your input! Answer The difference is that you are explicitly stating you

Advertisement