From: David Alan Black Date: 2002-04-15T08:01:59+09:00 Subject: Re: Reverse hash lookup? Hello -- On Mon, 15 Apr 2002, Martin DeMello wrote: > Alex Liebowitz wrote: > > Is there any way to specify a value and hash, and get the key corresponding > > to that value (in O(1) time, preferably)? > > How would this work in the case of more than one key having the same value? Hash#index seems to follow the default order of the keys (as returned by #keys)... so it's probably best (if you're using Hash#index) to regard it as undefined. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav