Skip to content

Instantly share code, notes, and snippets.

@willf
Created June 25, 2014 15:30
Show Gist options
  • Save willf/a1d9b939ccfc8f7d245b to your computer and use it in GitHub Desktop.
Save willf/a1d9b939ccfc8f7d245b to your computer and use it in GitHub Desktop.
Simple Scala Student class
case class Student (fn: String, ln: String) {
def name() = s"$fn $ln"
def greet() = s"Hello, $name"
}
val s = Student("John", "Doe")
val l = List(s,s,s)
val res = l.map{_.name.length}.sum
@v6ak
Copy link

v6ak commented Jul 21, 2014

I would write Seq instead of List.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment