This trait provides an Ordering instance for an enumeration as well
as functions which use that order. It works by extending the companion
object of the enumeration class.
@enum class Color {
Red
Blue
Yellow
}
object Color extends Ordered[Color]
This enables the following functions (and more).
Red < Blue // true
Blue.next
Color.next(Blue) // yellow
Yellow >= Yellow // true
Color.first // Red
Color.last // Yellow
This trait provides an
Ordering
instance for an enumeration as well as functions which use that order. It works by extending the companion object of the enumeration class.This enables the following functions (and more).