public Set<Item> intersect(Set<Item> that) {
        Set<Item> result = new Set<Item>();

        if (this.size() < that.size()) {
            for (int i = 0; i < capacity; ++i) {
                LinkedList<Item> chain = chains[i];
                
                if (chain == null) {
                    continue;
                }

                for (Item item: chain) {
                    if (that.contains(item)) {
                        result.put(item);
                    }
                }
            }
        } else {
            for (int i = 0; i < that.capacity; ++i) {
                LinkedList<Item> chain = that.chains[i];

                if (chain == null) {
                    continue;
                }

                for (Item item: chain) {
                    if (contains(item)) {
                        result.put(item);
                    }
                }
            }
        }

        return result;
    }