T
- the type of elements contained in the setspublic interface SetMetric<T> extends Metric<Set<T>>
The elements in the set have to implement Object.hashCode()
and
Object.equals(Object)
.
The elements in the sets may not be null if metric does not support null values.
The similarity measure should be consistent with equals such that
a.equals(b) => compare(a,b) == 1.0
.
The similarity measure should be reflexive such that
compare(a,a) == 1.0
.
The similarity measure should be symmetric such that
compare(a,b) == compare(b,a)
.
Implementations may not modify the contents of the set. Sets should be
treated as if wrapped by Collections.unmodifiableSet(Set)
.
Modifier and Type | Method and Description |
---|---|
float |
compare(Set<T> a,
Set<T> b)
Measures the similarity between sets a and b.
|
float compare(Set<T> a, Set<T> b)
compare
in interface Metric<Set<T>>
a
- set a to compareb
- set b to compareNullPointerException
- when either a or b is nullCopyright © 2014–2018. All rights reserved.