gradle
8.6

# find

open fun <T> find(pattern: String, items: Map<String, out T>): T(source)

Locates the best match for a camel case pattern in a key set of a map and returns the corresponding value.

#### Return

The matching item if exactly 1 match found, null if no matches or multiple matches.

#### See also

find(String, Collection)

open fun find(pattern: String, items: Collection<String>): String(source)

Locates the best match for a camel case pattern in a collection.

The pattern is expanded to match on camel case and on kebab case strings. For example, the pattern `gBD` matches to `gradleBinaryDistribution` and `gradle-binary-distribution`.

The method will return `null` if the pattern is an empty string.

If the target collection contains the pattern string then the method omits the pattern matching and returns the pattern.

#### Return

The match if exactly 1 match found, null if no matches or multiple matches.