Skip to content

Instantly share code, notes, and snippets.

@xuwei-k
Created May 20, 2011 07:45
Show Gist options
  • Save xuwei-k/982512 to your computer and use it in GitHub Desktop.
Save xuwei-k/982512 to your computer and use it in GitHub Desktop.
Scala Sleep Sort
Seq( 5, 3, 6, 3, 6, 3, 1, 4, 7 ).map{ i =>
() => concurrent.ops.spawn{
Thread.sleep(i * 100)
print(i+",")
}
}.foreach(_.apply)
//1,3,3,3,4,5,6,6,7,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment