Package net.sf.saxon.expr.sort
Class CustomSet<T>
java.lang.Object
net.sf.saxon.expr.sort.CustomSet<T>
- Type Parameters:
T
- The type of the entries in the set
A mutable set 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 java.util.Set<T>
. This is 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
ConstructorsConstructorDescriptionCustomSet
(EqualityMatcher<T> matcher) Create an empty set using the supplied equality matcher -
Method Summary
-
Constructor Details
-
CustomSet
Create an empty set using the supplied equality matcher- Parameters:
matcher
- the function used to compare items for equality
-
-
Method Details
-
add
Add a value to the set- Parameters:
value
- the value to be added.- Returns:
- true if the value is newly added, that is, if it was not already present
-
contains
Ask if a value exists in the set- Parameters:
value
- the requested value- Returns:
- true if it exists
-