Use Hash#key? to detect duplication instead of Array#include?

Array#include? is slow for many elements.