I
Ike
I am constantly trying to write my code (regardless of language) in the
lowest common denominator syntax (I'm too old, I've had to rewrite too much
code in my days! By doing this, conversion of code segments to other similar
languages in the future is far simpler). That is, code that essentially
looks the same in MOST languages (c, c++, php, java, c#). Thus, I try to
avoid, templates, generics, etc.
As such, I also try to avoid Iterators in Java. Say I have
ArrayList arrayList; //will hold String variables
Then I will "iterate," through this as:
for(int x = 0 ; x< arrayList.size(); x++){
String s = (String)arrayList.get(x);
// ...
}
Yes, I know that J2SE1.5 allows generics and such (of which I prefer not to
use for the same reasons mentioned earlier) however my real question here
is, since this seemingly more draconian means of iterating through a
collection, as demonstrated here, does, in fact, isuccefully iterate through
just as an Iterator does, am I suffering a sufficient performance hit by
doing so?
TIA, Ike
lowest common denominator syntax (I'm too old, I've had to rewrite too much
code in my days! By doing this, conversion of code segments to other similar
languages in the future is far simpler). That is, code that essentially
looks the same in MOST languages (c, c++, php, java, c#). Thus, I try to
avoid, templates, generics, etc.
As such, I also try to avoid Iterators in Java. Say I have
ArrayList arrayList; //will hold String variables
Then I will "iterate," through this as:
for(int x = 0 ; x< arrayList.size(); x++){
String s = (String)arrayList.get(x);
// ...
}
Yes, I know that J2SE1.5 allows generics and such (of which I prefer not to
use for the same reasons mentioned earlier) however my real question here
is, since this seemingly more draconian means of iterating through a
collection, as demonstrated here, does, in fact, isuccefully iterate through
just as an Iterator does, am I suffering a sufficient performance hit by
doing so?
TIA, Ike