This question evaluates implementation and API-design skills for iterators, specifically interface design and iterator semantics (hasNext/next), edge-case handling, correct exception behavior, amortized time and space complexity, and unit-testable behavior when implementing FlattenIterator and FilterIterator over integer collections in Java.

Define a minimal Iterator interface (e.g., hasNext(), next()) for integers without using IDE-generated scaffolding. Implement two iterator classes in Java: (