org.scalatra.util.MultiMapHeadView.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scalatra_2.8.2.RC1 Show documentation
Show all versions of scalatra_2.8.2.RC1 Show documentation
The core Scalatra framework
The newest version!
package org.scalatra.util
import scala.collection.immutable.Map
trait MultiMapHeadView[A, B] extends Map[A, B] {
protected def multiMap: Map[A, Seq[B]]
override def get(key: A) = multiMap.get(key) flatMap { _.headOption }
override def size = multiMap.size
override def iterator = multiMap map { case(k, v) => (k, v.head) } iterator
override def -(key: A) = Map() ++ this - key
override def +[B1 >: B](kv: (A, B1)) = Map() ++ this + kv
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy