Feb 06 2007
Java and Lazy Lists: I Stand Corrected (Sort Of)
Jakarta Commons-Collections actually does provide a lazy list kind of beast. They just didn’t realize they did it.
There is a class called ObjectGraphIterator, which could be use to simulate iterating over a lazy list (were one to be kinda tricky about it). Combined with the TransformIterator, we can accomplish the get-time retrieval manging that I was looking for.
So Java lazy list functionality can be reasonably achieved (in a somewhat limited fashion) using business-standard open source libraries. You still don’t end up with a list at the end of it all, but the main gist of the trick is there.
If you’re not sure what I’m babbling about, check out this post for an introduction to lazy lists in their natural environment, and this post for my railing about Java’s lack of lazy lists.
Popularity: 3% [?]