@Override
    public Map<String, String> toMap() {
        Map<String, String> map = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
        // Look at all top-level elements
        for (Element oElem : hashArray) {
            if (oElem != null) {
                // Must check all bucket entries as can be hash collision
                for (Entry<String, String> iElem : oElem.getAllEntries()) {
                    // Add any non-null ones that aren't already in (NB: LIFO)
                    if (!map.containsKey(iElem.getKey()))
                        map.put(iElem.getKey(), iElem.getValue());
                }
            }
        }
        return map;
    }
A simple multimap able to accept multiple values for a given key.
<p>
The implementation is specifically tuned for headers (such as HTTP), where
the number of entries tends to be moderate, but are frequently accessed.
</p>
<p>
This map expects ASCII for key strings.
</p>
<p>
Case is ignored (avoiding {@link String#toLowerCase()} <code>String</code> allocation)
before being hashed (<code>xxHash</code>).
</p>
<p>
    Constraints:
<ul>
  <li><strong>Not thread-safe.</strong></li>
  <li><tt>Null</tt> is <strong>not</strong> a valid key.</li>
</ul>
</p>

@author Marc Savy {@literal <msavy@redhat.com>}
gateway/engine/beans/src/main/java/io/apiman/gateway/engine/beans/util/CaseInsensitiveStringMultiMap.java