Query module IterableIterator

name
Iterator implementing Iterable
description
An ‘Iterator’ that also implements ‘Iterable’ by returning itself as its ‘Iterator’ does not support multiple traversals. This can lead to unexpected behavior when it is viewed as an ‘Iterable’.
kind
problem
problem.severity
warning
precision
very-high
id
java/iterator-implements-iterable
tags
correctness reliability

Imports

IterableClass
java

Provides all default Java QL imports.

Classes

EmptyIterableIterator

An IterableIterator that never returns any elements.

IterableIterator

An Iterable that is also its own Iterator.