public Element removeByHash(long hash, String key) {
            Element current = this;
            Element newHead = null;
            Element link = null;
            boolean removedAny = false;

            while (current != null) {
                // If matches hash and key, should discard.
                if (current.eq(hash, key)) {
                    Element prev = current.previous;
                    current.previous = null;
                    current = prev;
                    removedAny = true;
                    if (link != null)
                        link.previous = prev;
                } else if (newHead == null) {
                    newHead = link = current;
                    current = newHead.previous;
                } else {
                    link.previous = link = current;
                    current = current.previous;
                }
            }
            if (removedAny)
                keyCount--;
            return newHead;
        }
The <tt>keyHash</tt> is stored because we may have duplicate entries for a
given hash bucket for two reasons:

<ol>
  <li> Multiple value insertions for the same key (standard multimap behaviour)
  <li> Hash collision. The key is different, but maps to the same bucket.
</ol>

We can use the stored hash to rapidly differentiate between these scenarios
and in various operations such as delete.

@param key the key
@param value the value
@param keyHash the hash <strong>(NB: full hash, not just bucket index!)</strong>
gateway/engine/beans/src/main/java/io/apiman/gateway/engine/beans/util/CaseInsensitiveStringMultiMap.java