Skip to main content
  1. Posts/

Interesting behavior with Guava AbstractSequentialIterator and reusing objects

·42 words·1 min
Author
Christopher Taylor
A collection of interesting things I’ve seen, as I’ve seen them.

If you look at the AbstractSequentialIterator class in Google Guava, you’ll see that computeNext is called in the finally block of the next method.

What does that mean? You cannot reuse the previous object nor alter its value in the computeNext method.