Suppose that I have two arrays arrayOne
and arrayTwo
where arrayOne.length != arrayTwo.length
(suppose the similar case of two List
that have different size()
). Does any of the following offer a speed advantage over the other?
Option 1
for(int i = 0 ; i < arrayOne.length ; ++i) { for(int j = 0 ; j < arrayTwo.length ; ++j) { //Do something } }
Option 2
for(int i = 0 ; i < arrayTwo.length ; ++i) { for(int j = 0 ; j < arrayOne.length ; ++j) { //Do something } }