Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6ff29f9

Browse files
authored
Merge pull request #6931 from isaacl/iteratorOpt
Iterator micro opts
2 parents 4d39d4f + 5088c40 commit 6ff29f9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/library/scala/collection/Iterator.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ trait Iterator[+A] extends IterableOnce[A] with IterableOnceOps[A, Iterator, Ite
9191
*/
9292
@throws[NoSuchElementException]
9393
def next(): A
94-
def iterator = this
94+
95+
@inline final def iterator = this
9596

9697
/** Wraps the value of `next()` in an option.
9798
*
@@ -431,7 +432,10 @@ trait Iterator[+A] extends IterableOnce[A] with IterableOnceOps[A, Iterator, Ite
431432
-1
432433
}
433434

434-
final def length: Int = size
435+
@inline final def length: Int = size
436+
437+
@deprecatedOverriding("isEmpty is defined as !hasNext; override hasNext instead", "2.13.0")
438+
override def isEmpty: Boolean = !hasNext
435439

436440
def filter(p: A => Boolean): Iterator[A] = filterImpl(p, isFlipped = false)
437441

0 commit comments

Comments
 (0)