Annotation Interface IteratorPolyMod


If a collection's type is @IteratorPolyMod, then its iterator() and listIterator() methods preserve the ability to call modification methods in its iterator.

For example, if collection c has type @Shrinkable, then c.iterator() also has type @Shrinkable. If list l has type @Replaceable, then l.listIterator() also has type @Replaceable.

If the collection itself is @Unmodifiable, then its iterator is @Unshrinkable. That holds no matter what the collection's Iterator qualifier is: a @MaybeIteratorPolyMod collection's iterator does not acquire the collection's capabilities, but it does inherit the collection's lack of them. Only a collection that has neither the capability nor its negation -- for example, a @MaybeShrinkable @MaybeIteratorPolyMod collection -- has a @MaybeShrinkable iterator.

The Grow, Shrink, and Replace Checkers consult this annotation; the SeqGrow Checker does not, because an iterator has no sequenced-grow methods.

See the Checker Framework Manual:
Modifiability Checker