While loop, For loop and Iterator Performance Test – Java
Well... the result show that the Iterator mechanism is the slowest method to loop through a list. There's not much performance different between For and While loop.
Iterator provides a very handy way to loop through a list or collection, but it is slower than For and While loop. Please be remind that the different is just in milliseconds (not even 1 second for 15 millions of data looping). So, just choose any looping mechanism you want, there's not much different.
Read full article from While loop, For loop and Iterator Performance Test – Java
No comments:
Post a Comment