From e137af420ad1aa9de8f4f010189012a07337de6a Mon Sep 17 00:00:00 2001 From: Jerven bolleman Date: Fri, 15 Mar 2024 07:33:33 +0100 Subject: [PATCH] An empty iterator should throw a NoSuchElementException --- .../handlegraph4j/iterators/AutoClosedIterator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/jervenbolleman/handlegraph4j/iterators/AutoClosedIterator.java b/src/main/java/io/github/jervenbolleman/handlegraph4j/iterators/AutoClosedIterator.java index 7cf4860..c4f15a5 100644 --- a/src/main/java/io/github/jervenbolleman/handlegraph4j/iterators/AutoClosedIterator.java +++ b/src/main/java/io/github/jervenbolleman/handlegraph4j/iterators/AutoClosedIterator.java @@ -24,6 +24,7 @@ package io.github.jervenbolleman.handlegraph4j.iterators; import java.util.Iterator; +import java.util.NoSuchElementException; import java.util.PrimitiveIterator.OfLong; import java.util.function.Function; import java.util.function.LongFunction; @@ -339,7 +340,7 @@ public boolean hasNext() { @Override public T next() { - throw new IllegalStateException(); + throw new NoSuchElementException(); } }; }