style: include IT_NO_SUCH_ELEMENT (#5200)

This commit is contained in:
Piotr Idzik 2024-06-04 22:54:38 +02:00 committed by GitHub
parent f3db699083
commit 493942e319
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View File

@ -77,9 +77,6 @@
<Match>
<Bug pattern="UWF_UNWRITTEN_FIELD" />
</Match>
<Match>
<Bug pattern="IT_NO_SUCH_ELEMENT" />
</Match>
<Match>
<Bug pattern="DLS_DEAD_LOCAL_STORE" />
</Match>

View File

@ -148,8 +148,11 @@ public class LinkedQueue<T> implements Iterable<T> {
@Override
public T next() {
node = node.next;
return node.data;
if (hasNext()) {
node = node.next;
return node.data;
}
throw new NoSuchElementException();
}
};
}