From: Robert Klemme Date: 2007-07-31T06:05:01+09:00 Subject: Re: array.include? On 30.07.2007 19:16, Brett Simmers wrote: > Do you need the order of the items to be preserved? If not, you should > think about using a Set instead of an Array. You could then use > Set#add, which accomplishes the same thing and is MUCH faster, > especially if your data set gets fairly large. Array#include? has to do > a linear search over the entire Array, but most operations on Sets are > constant time, including Set#add, Set#add?, and Set#include? I'd also say that a Set seems most appropriate here (a Hash might as well, depending on what has to be done with the data). And you can even use << with a Set. Kind regards robert PS: Please do not top post.