Skip to content

Instantly share code, notes, and snippets.

@ghik
Created September 30, 2016 12:35
Show Gist options
  • Select an option

  • Save ghik/407457ab853753c7356dc08b94e5f36d to your computer and use it in GitHub Desktop.

Select an option

Save ghik/407457ab853753c7356dc08b94e5f36d to your computer and use it in GitHub Desktop.
sealed trait Zapieczętowany {
def accept[T](forPrzypadek: JFunction[Przypadek,T], forNieSądzę: JFunction[NieSądzę,T]): T = this match {
case p: Przypadek => forPrzypadek(p)
case ns: NieSądzę => forNieSądzę(ns)
}
}
case class Przypadek() extends Zapieczętowany
case class NieSądzę() extends Zapieczętowany
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment