Part of lp.services.utils View In Hierarchy
Some generators and iterators are expensive to calculate, like calculating the merge sorted revision graph for a bazaar branch, so you don't want to call them too often. Rearranging the code so it doesn't call the expensive iterator can make the code awkward. This class provides a way to have the iterator called once, and the results stored. The results can then be iterated over again, and more values retrieved from the iterator if necessary.