This is a groovy expression.

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


current is the next object candidate to add with three properties
selected is a list of the already added objects
The properties available are and toString() returns the axis value.

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
    

This example ensures the browser, platform and label are distinct.