From: Caleb Clausen Date: 2010-06-12T04:11:00+09:00 Subject: Re: comparing objects On 6/11/10, Robert Dober wrote: > OP wanted to use Array#&, and Array#&, for a reason not too clear to > me, uses Object#eql? instead of Object#== I did discourage the > overloading of Object#eql? and Object#hash for *that purpose*. Array#& uses eql? instead of == because internally, it works something like this: class Array def &(other) h1={} other.each{|x| h1[x]=true} select{|x| h1[x] } end end In other words, it creates a (hash) index to get a speedup. (From O(M*N) to O(M+N).)