Skip to content

Instantly share code, notes, and snippets.

@d6y
Created November 1, 2014 17:26
Show Gist options
  • Select an option

  • Save d6y/681283756e5be8c6542d to your computer and use it in GitHub Desktop.

Select an option

Save d6y/681283756e5be8c6542d to your computer and use it in GitHub Desktop.
Enuerations and case objects: usage
scala> import SolarSystemPlanets._
import SolarSystemPlanets._
scala> println(planets)
TreeSet(Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune)
scala> EARTH < MARS
res1: Boolean = true
scala> planets.filter(_.radius > 7.0e6)
res2: scala.collection.immutable.Set[SolarSystemPlanets.Planet] = TreeSet(Jupiter, Saturn, Uranus, Neptune)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment