JAVA0254: Use enhanced for loop construct
Hello,
I have another question for the forum. I've been working with Enerjy for several weeks now, and really like it. I've learned a lot, and have much cleaner code thanks to it's incessant nagging about my sloppy java habits.
Unfortunately, there are still a few things that I'm struggling with.
I have written a whole lot of classes that iterate over (VERY large - several 10's or 100's of Gigs) data files, which have to process these files row by row. As such, each class that interprets these files implements the Iterator class.
Unfortunately, by using the iterator, I now trigger JAVA0254 all over the place, which complains that I should be using a for loop construct instead of the iterator interface. In general, that makes sense, but there's no way I'm going to try to pre-load 100's of Gigs of data to make the class Iterable.
Am I missing something, or is this really an inappropriate time for the JAVA0254 warning to be triggered? (Not that I expect it to be able to differentiate between the objects I'm iterating over, but I figure this must be a relatively common situation for people dealing with large data files. How do other people deal with this?)
Thanks!
|