-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Current implementation of buildableOfCollCond isn't as performant as it could be, an alternative version such as
@SuppressWarnings(
Array(
"scalafix:DisableSyntax.while",
"scalafix:DisableSyntax.return"
)
)
@scala.annotation.nowarn("msg=return statement uses an exception")
private def buildableOfCollCond[C <: Iterable[T], T](cond: C => Boolean, g: Gen[C])(implicit
evb: Buildable[T, C]
): Gen[C] =
Gen.infiniteLazyList(g).map { ll =>
val it = ll.iterator
val bldr = evb.builder
while (true) {
val result = bldr.result()
if (cond(result)) {
return result
}
bldr ++= it.next()
}
return bldr.result()
}Note that this version of buildableOfCollCond doesn't actually it (it seems to have termination issues).
Metadata
Metadata
Assignees
Labels
No labels