9

I know when a class is parameterized, it could be declared as

class A[T]

I see declaration of RDD of Spark begins with:

abstract class RDD[T: ClassTag]

I don't know what does the : ClassTag mean.

sksamuel
  • 16,154
  • 8
  • 60
  • 108
user2018791
  • 1,143
  • 15
  • 29
  • 2
    Actually, colon means "context bound", ClassTag is a part of new scala reflection and you can easily get to know it on scala website, this is RTFM question (you may search on SO, plenty of questions): http://stackoverflow.com/questions/2982276/what-is-a-context-bound-in-scala, http://docs.scala-lang.org/overviews/reflection/typetags-manifests.html – dmitry Jul 11 '14 at 05:56
  • 1
    Thanks. I never know this syntax is called context view. I found an comprehensive explanation here: http://stackoverflow.com/questions/4465948/what-are-scala-context-and-view-bounds/4467012#4467012 – user2018791 Jul 11 '14 at 07:51

1 Answers1

5

This is a syntactic variant for writing

abstract class RDD[T](implicit context: ClassTag[T])

The comments to this question already link to two related questions that explain what this so-called 'context bound' is about.

0__
  • 66,707
  • 21
  • 171
  • 266