Iteration over a sealed trait in Scala?
问题 I just wanted to know if it is possible to iterate over a sealed trait in Scala? If not, why is it not possible? Since the trait is sealed it should be possible no? What I want to do is something like that: sealed trait ResizedImageKey { /** * Get the dimensions to use on the resized image associated with this key */ def getDimension(originalDimension: Dimension): Dimension } case class Dimension(width: Int, height: Int) case object Large extends ResizedImageKey { def getDimension