From: Gene Tani Date: 2005-12-09T03:17:35+09:00 Subject: Re: ordered/sorted hash Steve Litt wrote: > On Thursday 08 December 2005 12:37 pm, robertj wrote: > > hi, > > > > is there anywhere a class that does soemthing > > akin to java.util.SortedMap? that is sorting > > and iterating over the hash in the order of its > > keys. > > When I tried it, it seemed that Ruby automatically sorted the keys. I'm not > sure if this is what you want, but see this: > > http://www.troubleshooters.com/codecorn/ruby/basictutorial.htm#_Hashes > Not sure what "it" is, but Hash#sort will convert the hash to a list of lists, sorted by their keys Then others have put in rbtrees, arrays accessed by keywords, http://raa.ruby-lang.org/project/ruby-rbtree/ http://codeforpeople.com/lib/ruby/arrayfields/arrayfields-3.5.0/README