Skip to content

Instantly share code, notes, and snippets.

@kxbmap
Created April 15, 2011 06:24
Show Gist options
  • Save kxbmap/921241 to your computer and use it in GitHub Desktop.
Save kxbmap/921241 to your computer and use it in GitHub Desktop.
Scala2.8.1でList[java.util.Date].min
scala> trait DateOrdering extends scala.math.Ordering[java.util.Date] {
| def compare(x: java.util.Date, y: java.util.Date) = x.compareTo(y)
| }
defined trait DateOrdering
scala> implicit object Date extends DateOrdering
defined module Date
scala> List(new java.util.Date()).min
res6: java.util.Date = Fri Apr 15 15:16:18 JST 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment