don't use toStream

Ref #3979
toStream doesn't help performance.
This commit is contained in:
Eugene Yokota 2018-03-10 18:40:24 -05:00
parent d2f2a90d5e
commit 07e26a1dcf
1 changed files with 2 additions and 2 deletions

View File

@ -35,10 +35,10 @@ private final class Settings0[Scope](
data.flatMap { case (scope, map) => map.keys.map(k => f(scope, k)) }.toSeq
def get[T](scope: Scope, key: AttributeKey[T]): Option[T] =
delegates(scope).toStream.flatMap(sc => getDirect(sc, key)).headOption
delegates(scope).flatMap(sc => getDirect(sc, key)).headOption
def definingScope(scope: Scope, key: AttributeKey[_]): Option[Scope] =
delegates(scope).toStream.find(sc => getDirect(sc, key).isDefined)
delegates(scope).find(sc => getDirect(sc, key).isDefined)
def getDirect[T](scope: Scope, key: AttributeKey[T]): Option[T] =
(data get scope).flatMap(_ get key)