Hi.
The question being thought today while completing my task is about the loop efficiency..
Lets say. I have an array {'a','x','a','a'} And a loop that should avoid 'x' element Now i wonder how these two approach differ in term of efficiency - not taking the while or do-while or for loops differentiation
char[] arrExample = {'a','x','a','a'};
for(int idx = 0; idx<arrExample.length; idx++){
if(arrExample[idx] == 'x')
continue;
System.out.println(arrExample[idx]);
}
and the common loop look like this
char[] arrExample = {'a','x','a','a'};
for(int idx = 0; idx<arrExample.length; idx++){
if(arrExample[idx] != 'x')
System.out.println(arrExample[idx]);
}
so.. expert comments are pleased. Thanks!