Remove redundant collection conversions

This commit is contained in:
Pierre DAL-PRA 2015-08-01 12:05:35 +02:00
parent 345cceafe6
commit c1de41f5c0
2 changed files with 3 additions and 3 deletions

View File

@ -52,7 +52,7 @@ object IMap {
put(k, f(this get k getOrElse init))
def mapValues[V2[_]](f: V ~> V2) =
new IMap0[K, V2](backing.mapValues(x => f(x)).toMap)
new IMap0[K, V2](backing.mapValues(x => f(x)))
def mapSeparate[VL[_], VR[_]](f: V ~> ({ type l[T] = Either[VL[T], VR[T]] })#l) =
{

View File

@ -17,9 +17,9 @@ sealed trait Settings[Scope] {
}
private final class Settings0[Scope](val data: Map[Scope, AttributeMap], val delegates: Scope => Seq[Scope]) extends Settings[Scope] {
def scopes: Set[Scope] = data.keySet.toSet
def scopes: Set[Scope] = data.keySet
def keys(scope: Scope) = data(scope).keys.toSet
def allKeys[T](f: (Scope, AttributeKey[_]) => T): Seq[T] = data.flatMap { case (scope, map) => map.keys.map(k => f(scope, k)) } toSeq;
def allKeys[T](f: (Scope, AttributeKey[_]) => T): Seq[T] = 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