Using an Iterator to iterate over a List is not always faster than using get(i). If you don’t know what implementation of List you are getting at compile time, you can use a block of code like this to choose the best type of iteration at runtime:
© 2017 Nilesh D Kapadia