Skip to content

Instantly share code, notes, and snippets.

@ClintCombs
Last active August 29, 2015 14:02
Show Gist options
  • Save ClintCombs/186b9804b1b37ee2280b to your computer and use it in GitHub Desktop.
Save ClintCombs/186b9804b1b37ee2280b to your computer and use it in GitHub Desktop.
Initialization for Groovy dudes.
// Scala Person case class
case class Person(first: String = "", last: String = "", age: Int = 0)
val p = Person(first = "John", last = "McPeek", age = 19)
val p1 = Person(first = "John")
// Scala PersonTrait
trait PersonTrait {
def first: String
def last: String
def age: Int
}
val pt = new PersonTrait { val first = "John"; val last = "McPeek"; val age = 19 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment