api / org.gradle.api.attributes / AttributeMatchingStrategy / ordered

ordered

abstract fun ordered(comparator: Comparator<T>): Unit

A short-hand way to define both a compatibility rule and a disambiguation rule based on an order defined by the provided Comparator.

All provider values which are lower than or equal the consumer value are compatible. When disambiguating, it will pick the highest compatible value.

Parameters

comparator - the comparator to use for compatibility and disambiguation

abstract fun ordered(pickLast: Boolean, comparator: Comparator<T>): Unit

A short-hand way to define both a compatibility rule and a disambiguation rule based on an order defined by the provided Comparator.

All provider values which are lower than or equal the consumer value are compatible.

Parameters

pickLast - tells if, for disambiguation, we should pick the last value in order instead of the first one

comparator - the comparator to use for compatibility and disambiguation