Skip to content

Commit 7a3f8ec

Browse files
committed
fixup! adds groupUntilChanged extension method on scala.collection.Iterator
inlines `key` since it is only used once
1 parent f00431f commit 7a3f8ec

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/main/scala/scala/collection/decorators/IteratorDecorator.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,9 @@ class IteratorDecorator[A](val `this`: Iterator[A]) extends AnyVal {
102102
hd match {
103103
case None => Iterator.empty.next()
104104
case Some(head) =>
105-
val key = f(head)
106105
hd = `this`.nextOption()
107106
var seq = mutable.Buffer(head)
108-
while (hd.exists(el => f(el) == key)) {
107+
while (hd.exists(el => f(el) == f(head))) {
109108
seq = seq ++ hd
110109
hd = `this`.nextOption()
111110
}

0 commit comments

Comments
 (0)