There is a utility class which implements Levenshtien distance to select different combinations.
The default is a distance of 12, which means to say all the capabilities have to be at least 12 characters different.
There are two objects available to the expression
Examples (you need to import the Levenshtien class to use it)
import org.jenkinsci.plugins.Levenshtien
def different = true
selected.any {
if (Levenshtien.distance(current.browserName, it.browserName) < 1) {
different = false
true
}
if (Levenshtien.distance(current.platformName, it.platformName) < 1) {
different = false
true
}
if (Levenshtien.distance(current.toString(), it.toString()) < 12) {
different = false
true
}
}
return different