Skip to content

Instantly share code, notes, and snippets.

@jonvuri
Created March 7, 2016 06:58
Show Gist options
  • Save jonvuri/e2e0a29fe09ab51d3d5c to your computer and use it in GitHub Desktop.
Save jonvuri/e2e0a29fe09ab51d3d5c to your computer and use it in GitHub Desktop.
def walk[T](caseClass: T): Iterator[String] = caseClass match {
case string: String => Iterator(string)
case product: Product => product.productIterator.flatMap(walk)
case _ => Iterator()
}
if (walk(config).contains(null)) {
throw new Exception("Case class structure has null")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment