17.1. Generic Classes
As in Java or C++, classes and traits can have type parameters. In Scala, you use square brackets for type parameters, for example:
class Pair[T, S](val first: T, val second: S)
You are currently reading a PREVIEW of this book.
Get instant access to over
$1 million worth of books and videos.
Start a Free Trial