Class CustomMap<K,V>

java.lang.Object
net.sf.saxon.expr.sort.CustomMap<K,V>

public class CustomMap<K,V> extends Object
A map implementation using a custom equality matcher, to avoid having to wrap each entry in a wrapper object to achieve customised equality testing.

Note: this doesn't implement Map<K, V> to save the effort of implementing methods like size() and iterator() that aren't required for our use cases. These methods could easily be added without changing the basic design.

  • Constructor Details

  • Method Details

    • put

      public V put(K key, V value)
      Add an entry to the map
      Parameters:
      key - the new key
      value - the value to be added.
      Returns:
      the previous value for the key if there was one, or null otherwise
    • get

      public V get(K key)
      Get the value associated with a given key, or null if absemt
      Parameters:
      key - the new key
      Returns:
      the value for the key if there is one, or null otherwise
    • containsKey

      public boolean containsKey(K key)
      Ask if a key exists in the set of keys
      Parameters:
      key - the requested key
      Returns:
      true if it exists
    • keys

      public List<K> keys()
      List all the keys.
      Returns:
      a list of all the keys
    • values

      public List<V> values()
      List all the values.
      Returns:
      a list of all the values