summaryrefslogtreecommitdiff
path: root/src/library/scalax/collection/generic/covariant/IterableFactory.scala
blob: 67445f54d94e198ce1228ca275093fdc681b3849 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
package scalax.collection.generic.covariant

trait IterableFactory[CC[+A] <: Iterable[A]] extends generic.IterableFactory[CC] {

  /** The empty collection of type CC */
  val empty: CC[Nothing]

  override protected def newBuilder[A]: Builder[CC, A] =
    empty.newBuilder[A].asInstanceOf[Builder[CC, A]]

  /** Create CC collection of specified elements */
  override def apply[A](args: A*): CC[A] =
    (empty ++ args.asInstanceOf[Iterable[A]]).asInstanceOf[CC[A]] // !!!
}