Skip to content

Instantly share code, notes, and snippets.

Created March 20, 2011 20:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save anonymous/878653 to your computer and use it in GitHub Desktop.
Save anonymous/878653 to your computer and use it in GitHub Desktop.
import java.util.Collections
import java.util.ArrayList
list = ArrayList.new [ "one", "two", "three", "four" ]
puts "unsorted: #{list}"
Collections.sort(list) do |s1, s2|
l1 = dynamic(s1).length
l2 = dynamic(s2).length
Integer(l1.compareTo(l2)).intValue
end
puts "sorted: #{list}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment