Package net.sf.saxon.expr.sort
Class CustomMap<K,V>
- java.lang.Object
-
- net.sf.saxon.expr.sort.CustomMap<K,V>
-
public class CustomMap<K,V> extends java.lang.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 Summary
Constructors Constructor Description CustomMap(EqualityMatcher<K> matcher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(K key)
Ask if a key exists in the set of keysV
get(K key)
Get the value associated with a given key, or null if absemtjava.util.List<K>
keys()
List all the keys.V
put(K key, V value)
Add an entry to the mapjava.util.List<V>
values()
List all the values.
-
-
-
Constructor Detail
-
CustomMap
public CustomMap(EqualityMatcher<K> matcher)
-
-
Method Detail
-
put
public V put(K key, V value)
Add an entry to the map- Parameters:
key
- the new keyvalue
- 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 java.util.List<K> keys()
List all the keys.- Returns:
- a list of all the keys
-
values
public java.util.List<V> values()
List all the values.- Returns:
- a list of all the values
-
-