Skip to content

Instantly share code, notes, and snippets.

@davegurnell
Last active October 6, 2015 10:35
Show Gist options
  • Select an option

  • Save davegurnell/5dfa6093be6b5c2d3ee9 to your computer and use it in GitHub Desktop.

Select an option

Save davegurnell/5dfa6093be6b5c2d3ee9 to your computer and use it in GitHub Desktop.
case class Director(firstName: String, lastName: String, yearOfBirth: Int)
case class Film(title: String, yearOfRelease: Int, imdbRating: Double, director: Director)
val eastwood = new Director("Clint", "Eastwood", 1930)
val mcTiernan = new Director("John", "McTiernan", 1951)
val nolan = new Director("Christopher", "Nolan", 1970)
val someBody = new Director("Just", "Some Body", 1990)
val memento = new Film("Memento", 2000, 8.5, nolan)
val darkKnight = new Film("Dark Knight", 2008, 9.0, nolan)
val inception = new Film("Inception", 2010, 8.8, nolan)
val highPlainsDrifter = new Film("High Plains Drifter", 1973, 7.7, eastwood)
val outlawJoseyWales = new Film("The Outlaw Josey Wales", 1976, 7.9, eastwood)
val unforgiven = new Film("Unforgiven", 1992, 8.3, eastwood)
val granTorino = new Film("Gran Torino", 2008, 8.2, eastwood)
val invictus = new Film("Invictus", 2009, 7.4, eastwood)
val predator = new Film("Predator", 1987, 7.9, mcTiernan)
val dieHard = new Film("Die Hard", 1988, 8.3, mcTiernan)
val huntForRedOctober = new Film("The Hunt for Red October", 1990, 7.6, mcTiernan)
val thomasCrownAffair = new Film("The Thomas Crown Affair", 1999, 6.8, mcTiernan)
val films = Seq(memento, darkKnight, inception,
highPlainsDrifter, outlawJoseyWales, unforgiven, granTorino, invictus,
predator, dieHard, huntForRedOctober, thomasCrownAffair)
case class Film(
name: String,
yearOfRelease: Int,
imdbRating: Double)
case class Director(
firstName: String,
lastName: String,
yearOfBirth: Int,
films: Seq[Film])
val memento = new Film("Memento", 2000, 8.5)
val darkKnight = new Film("Dark Knight", 2008, 9.0)
val inception = new Film("Inception", 2010, 8.8)
val highPlainsDrifter = new Film("High Plains Drifter", 1973, 7.7)
val outlawJoseyWales = new Film("The Outlaw Josey Wales", 1976, 7.9)
val unforgiven = new Film("Unforgiven", 1992, 8.3)
val granTorino = new Film("Gran Torino", 2008, 8.2)
val invictus = new Film("Invictus", 2009, 7.4)
val predator = new Film("Predator", 1987, 7.9)
val dieHard = new Film("Die Hard", 1988, 8.3)
val huntForRedOctober = new Film("The Hunt for Red October", 1990, 7.6)
val thomasCrownAffair = new Film("The Thomas Crown Affair", 1999, 6.8)
val eastwood = new Director("Clint", "Eastwood", 1930,
Seq(highPlainsDrifter, outlawJoseyWales, unforgiven, granTorino, invictus))
val mcTiernan = new Director("John", "McTiernan", 1951,
Seq(predator, dieHard, huntForRedOctober, thomasCrownAffair))
val nolan = new Director("Christopher", "Nolan", 1970,
Seq(memento, darkKnight, inception))
val someGuy = new Director("Just", "Some Guy", 1990,
Seq())
val directors = Seq(eastwood, mcTiernan, nolan, someGuy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment