Skip to content

Commit 1eaffd5

Browse files
committed
[squash] remove Objects.requireNonNull
1 parent 8a70a3d commit 1eaffd5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/library/scala/collection/Iterator.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package scala.collection
22

33
import java.io.{ObjectInputStream, ObjectOutputStream}
4-
import java.util.Objects
54

65
import scala.collection.mutable.{ArrayBuffer, Builder, ImmutableBuilder}
76
import scala.annotation.tailrec
@@ -1097,7 +1096,11 @@ object Iterator extends IterableFactory[Iterator] {
10971096

10981097
override def hasNext: Boolean = {
10991098
if (nextResult eq null) {
1100-
nextResult = Objects.requireNonNull(f(state), "null during unfold")
1099+
nextResult = {
1100+
val res = f(state)
1101+
if (res eq null) throw new NullPointerException("null during unfold")
1102+
res
1103+
}
11011104
state = null.asInstanceOf[S] // allow GC
11021105
}
11031106
nextResult.isDefined

0 commit comments

Comments
 (0)