gradle
8.2

# GUtil

open class GUtil

### Deprecated

This class is only here to maintain binary compatibility with existing plugins.

Plugins should prefer external collection frameworks over this class. Internally, all code should use org.gradle.util.internal.GUtil.

#### Deprecated

Will be removed in Gradle 9.0.

## Constructors

GUtil
Link copied to clipboard
constructor()

## Functions

addMaps
Link copied to clipboard
open fun <K, V> addMaps(map1: Map<K, V>, map2: Map<K, V>): Map<K, V>
addToCollection
Link copied to clipboard
open fun <V, T : Collection<out Any>?> addToCollection(dest: T, src: Iterable<out V>): T
open fun <V, T : Collection<out Any>?> addToCollection(dest: T, srcs: Array<Iterable<out V>>): T
open fun <V, T : Collection<out Any>?> addToCollection(dest: T, failOnNull: Boolean, src: Iterable<out V>): T
open fun <V, T : Collection<out Any>?> addToCollection(dest: T, failOnNull: Boolean, srcs: Array<Iterable<out V>>): T
addToMap
Link copied to clipboard
open fun addToMap(dest: Map<String, String>, src: Map<out Any, out Any>)
asPath
Link copied to clipboard
open fun asPath(collection: Iterable<out Any>): String
caseInsensitive
Link copied to clipboard
open fun caseInsensitive(): Comparator<String>
collectionize
Link copied to clipboard
open fun collectionize(input: Any): Collection<out Any>
Flattens input collections (including arrays *but* not maps).
elvis
Link copied to clipboard
@Nullable
open fun <T> elvis(@Nullable object: T, @Nullable defaultValue: T): T
Prefer getOrDefault if the value is expensive to compute or would trigger early configuration.
endsWith
Link copied to clipboard
open fun endsWith(longer: CharSequence, shorter: CharSequence): Boolean
Checks whether the fist CharSequence ends with the second.
flatten
Link copied to clipboard
open fun flatten(elements: Collection<Any>): List<Any>
open fun <T : Collection<out Any>?> flatten(elements: Array<Any>, addTo: T): T
open fun <T : Collection<out Any>?> flatten(elements: Collection<out Any>, addTo: T): T
open fun flatten(elements: Collection<Any>, flattenMapsAndArrays: Boolean): List<Any>
open fun <T : Collection<out Any>?> flatten(elements: Array<Any>, addTo: T, flattenMaps: Boolean): T
open fun <T : Collection<out Any>?> flatten(elements: Collection<out Any>, addTo: T, flattenMapsAndArrays: Boolean): T
open fun <T : Collection<out Any>?> flatten(elements: Collection<out Any>, addTo: T, flattenMaps: Boolean, flattenArrays: Boolean): T
flattenElements
Link copied to clipboard
open fun <T : Collection<out Any>?> flattenElements(elements: Array<Any>): T
getOrDefault
Link copied to clipboard
@Nullable
open fun <T> getOrDefault(@Nullable object: T, defaultValueSupplier: Factory<T>): T
isSecureUrl
Link copied to clipboard
open fun isSecureUrl(url: URI): Boolean
isTrue
Link copied to clipboard
open fun isTrue(@Nullable object: Any): Boolean
last
Link copied to clipboard
open fun <T> last(comparator: Comparator<out Any>, lastValue: T): Comparator<T>
loadProperties
Link copied to clipboard
open fun loadProperties(propertyFile: File): Properties
open fun loadProperties(inputStream: InputStream): Properties
open fun loadProperties(url: URL): Properties
map
Link copied to clipboard
open fun map(objects: Array<Any>): Map<Any, Any>
prefix
Link copied to clipboard
open fun prefix(prefix: String, strings: Collection<String>): List<String>
saveProperties
Link copied to clipboard
open fun saveProperties(properties: Properties, propertyFile: File)
open fun saveProperties(properties: Properties, outputStream: OutputStream)
serialize
Link copied to clipboard
open fun serialize(object: Any): Array<Byte>
open fun serialize(object: Any, outputStream: OutputStream)
toCamelCase
Link copied to clipboard
open fun toCamelCase(string: CharSequence): String
Converts an arbitrary string to a camel-case string which can be used in a Java identifier.
toConstant
Link copied to clipboard
open fun toConstant(string: CharSequence): String
Converts an arbitrary string to upper case identifier with words separated by _.
toEnum
Link copied to clipboard
open fun <T : Enum<T>?> toEnum(enumType: Class<out T>, value: Any): T
toEnumSet
Link copied to clipboard
open fun <T : Enum<T>?> toEnumSet(enumType: Class<T>, values: Iterable<out Any>): EnumSet<T>
open fun <T : Enum<T>?> toEnumSet(enumType: Class<T>, values: Array<Any>): EnumSet<T>
toLowerCamelCase
Link copied to clipboard
open fun toLowerCamelCase(string: CharSequence): String
toSecureUrl
Link copied to clipboard
open fun toSecureUrl(scriptUri: URI): URI
toString
Link copied to clipboard
open fun toString(names: Iterable<out Any>): String
toWords
Link copied to clipboard
open fun toWords(string: CharSequence): String
Converts an arbitrary string to space-separated words.
open fun toWords(string: CharSequence, separator: Char): String
uncheckedCall
Link copied to clipboard
@Nullable
open fun <T> uncheckedCall(callable: Callable<T>): T
Calls the given callable converting any thrown exception to an unchecked exception via throwAsUncheckedException