Scala Library: scala.collection.generic.GenericClassTagCompanion
scala.collection.generic.GenericClassTagCompanion
abstract class GenericClassTagCompanion[+CC[X] <: Traversable[X]] extends AnyRef
This class represents companions of classes which require ClassTags for their element types.
Type Members
type Coll = CC[_]
- Attributes
- protected[this]
Abstract Value Members From scala.collection.generic.GenericClassTagCompanion
abstract def newBuilder[A](implicit ord: ClassTag[A]): Builder[A, CC[A]]
(defined at scala.collection.generic.GenericClassTagCompanion)
Concrete Value Members From scala.collection.generic.GenericClassTagCompanion
def apply[A](elems: A*)(implicit ord: ClassTag[A]): CC[A]
(defined at scala.collection.generic.GenericClassTagCompanion)
def empty[A](implicit arg0: ClassTag[A]): CC[A]
(defined at scala.collection.generic.GenericClassTagCompanion)
Instance Constructors From scala.collection.generic.GenericClassTagCompanion
new GenericClassTagCompanion()
(defined at scala.collection.generic.GenericClassTagCompanion)
Full Source:
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
package scala
package collection
package generic
import mutable.Builder
import scala.language.higherKinds
import scala.reflect.ClassTag
/** This class represents companions of classes which require ClassTags
* for their element types.
*
* @author Aleksandar Prokopec
*/
abstract class GenericClassTagCompanion[+CC[X] <: Traversable[X]] {
protected[this] type Coll = CC[_]
def newBuilder[A](implicit ord: ClassTag[A]): Builder[A, CC[A]]
def empty[A: ClassTag]: CC[A] = newBuilder[A].result()
def apply[A](elems: A*)(implicit ord: ClassTag[A]): CC[A] = {
val b = newBuilder[A]
b ++= elems
b.result()
}
}
Interested in Scala?
I send out weekly, personalized emails with articles and conference talks.
Subscribe now.