Skip to content

Instantly share code, notes, and snippets.

@shaunoconnell
Created January 21, 2014 22:36
Show Gist options
  • Save shaunoconnell/8549888 to your computer and use it in GitHub Desktop.
Save shaunoconnell/8549888 to your computer and use it in GitHub Desktop.
scala sort
import scala.collection.JavaConversions._
object SampleSort {
def main(args:Array[String]) = {
val myHash = new java.util.concurrent.ConcurrentHashMap[String,String]()
myHash.put("foo", "last")
myHash.put("bar", "first")
myHash.keys().toList.sorted.foreach((key:String) => {
val v = myHash.get(key)
println(s"$key: $v")
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment