Skip to content

Instantly share code, notes, and snippets.

@huynhjl
Created January 26, 2010 08:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huynhjl/286682 to your computer and use it in GitHub Desktop.
Save huynhjl/286682 to your computer and use it in GitHub Desktop.
def yieldClass2(clazz:Class[_]): Iterator[Class[_]] = {
import scala.collection.{Iterator => I}
clazz match {
case null => I.empty
case _ =>
val interfaces = clazz.getInterfaces map { yieldClass2 } reduceLeft (_ ++ _)
I.single(clazz) ++ yieldClass2(clazz.getSuperclass) ++ interfaces
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment