title: How to get rid of : class type required but T found
body: <p>How to solve this compilation error :</p>
  
  <pre><code>trait Container {
    def getInts() : Seq[Int]
    def getStrings() : Seq[String]
  
    def put[T](t: T)
    def get[T] : Seq[T]
  }
  
  class MutableContainer extends Container {
    val entities = new mutable.HashMap[Class[_], mutable.Set[Any]]() with mutable.MultiMap[Class[_], Any]
  
    override def getStrings(): Seq[String] = entities.get(classOf[String]).map(_.toSeq).getOrElse(Seq.empty).asInstanceOf[Seq[String]] //strings
    override def getInts(): Seq[Int] = entities.get(classOf[Int]).map(_.toSeq).getOrElse(Seq.empty).asInstanceOf[Seq[Int]]
  
    override def get[T]: Seq[T] = entities.get(classOf[T]).map(_.toSeq).getOrElse(Seq.empty).asInstanceOf[Seq[T]]
    override def put[T](t: T): Unit = entities.addBinding(t.getClass, t)
  }
  </code></pre>
  
  <p>Here is the error :</p>
  
  <pre><code>[error] Container.scala:23: class type required but T found
  [error]       override def get[T]: Seq[T] = entities.get(classOf[T]).map(_.toSeq).getOrElse(Seq.empty).asInstanceOf[Seq[T]]
  </code></pre>