GUtil (Gradle API 8.14.3)
Description: declaration: package: org.gradle.util, class: GUtil

Package org.gradle.util

# Class GUtil

java.lang.Object
org.gradle.util.GUtil

@Deprecated public class GUtil extends Object
Deprecated.
Will be removed in Gradle 9.0.
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 `GUtil`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GUtil()`
  Deprecated.

- ## Method Summary

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

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### GUtil

    public GUtil()
    Deprecated.

- ## Method Details

  - ### flatten

    public static <T extends Collection<?>> T flatten(Object[] elements, T addTo, boolean flattenMaps)
    Deprecated.

  - ### flatten

    public static <T extends Collection<?>> T flatten(Object[] elements, T addTo)
    Deprecated.

  - ### flatten

    public static <T extends Collection<?>> T flatten(Collection<?> elements, T addTo)
    Deprecated.

  - ### flattenElements

    public static <T extends Collection<?>> T flattenElements(Object... elements)
    Deprecated.

  - ### flatten

    public static <T extends Collection<?>> T flatten(Collection<?> elements, T addTo, boolean flattenMapsAndArrays)
    Deprecated.

  - ### flatten

    public static <T extends Collection<?>> T flatten(Collection<?> elements, T addTo, boolean flattenMaps, boolean flattenArrays)
    Deprecated.

  - ### collectionize

    public static Collection<?> collectionize(Object input)
    Deprecated.
    Flattens input collections (including arrays *but* not maps). If input is not a collection wraps it in a collection and returns it.
    Parameters:
      `input` - any object
    Returns:
      collection of flattened input or single input wrapped in a collection.

  - ### flatten

    public static List<Object> flatten(Collection<Object> elements, boolean flattenMapsAndArrays)
    Deprecated.

  - ### flatten

    public static List<Object> flatten(Collection<Object> elements)
    Deprecated.

  - ### asPath

    public static String asPath(Iterable<?> collection)
    Deprecated.

  - ### prefix

    public static List<String> prefix(String prefix, Collection<String> strings)
    Deprecated.

  - ### isTrue

    public static boolean isTrue(@Nullable Object object)
    Deprecated.

  - ### elvis

    @Nullable public static <T> T elvis(@Nullable T object, @Nullable T defaultValue)
    Deprecated.
    Prefer `getOrDefault(Object, Factory)` if the value is expensive to compute or would trigger early configuration.

  - ### getOrDefault

    @Nullable public static <T> T getOrDefault(@Nullable T object, org.gradle.internal.Factory<T> defaultValueSupplier)
    Deprecated.

  - ### addToCollection

    public static <V, T extends Collection<? super V>> T addToCollection(T dest, boolean failOnNull, Iterable<? extends V> src)
    Deprecated.

  - ### addToCollection

    public static <V, T extends Collection<? super V>> T addToCollection(T dest, Iterable<? extends V> src)
    Deprecated.

  - ### addToCollection

    @Deprecated public static <V, T extends Collection<? super V>> T addToCollection(T dest, boolean failOnNull, Iterable<? extends V>... srcs)
    Deprecated.

  - ### addToCollection

    @Deprecated public static <V, T extends Collection<? super V>> T addToCollection(T dest, Iterable<? extends V>... srcs)
    Deprecated.

  - ### caseInsensitive

    public static Comparator<String> caseInsensitive()
    Deprecated.

  - ### addMaps

    public static <K, V> Map<K,V> addMaps(Map<K,V> map1, Map<K,V> map2)
    Deprecated.

  - ### addToMap

    public static void addToMap(Map<String,String> dest, Map<?,?> src)
    Deprecated.

  - ### loadProperties

    public static Properties loadProperties(File propertyFile)
    Deprecated.

  - ### loadProperties

    public static Properties loadProperties(URL url)
    Deprecated.

  - ### loadProperties

    public static Properties loadProperties(InputStream inputStream)
    Deprecated.

  - ### saveProperties

    public static void saveProperties(Properties properties, File propertyFile)
    Deprecated.

  - ### saveProperties

    public static void saveProperties(Properties properties, OutputStream outputStream)
    Deprecated.

  - ### map

    public static Map<Object,Object> map(Object... objects)
    Deprecated.

  - ### toString

    public static String toString(Iterable<?> names)
    Deprecated.

  - ### toCamelCase

    public static String toCamelCase(CharSequence string)
    Deprecated.
    Converts an arbitrary string to a camel-case string which can be used in a Java identifier. Eg, with_underscores -> withUnderscores

  - ### toLowerCamelCase

    public static String toLowerCamelCase(CharSequence string)
    Deprecated.

  - ### toConstant

    public static String toConstant(CharSequence string)
    Deprecated.
    Converts an arbitrary string to upper case identifier with words separated by _. Eg, camelCase -> CAMEL_CASE

  - ### toWords

    public static String toWords(CharSequence string)
    Deprecated.
    Converts an arbitrary string to space-separated words. Eg, camelCase -> camel case, with_underscores -> with underscores

  - ### toWords

    public static String toWords(CharSequence string, char separator)
    Deprecated.

  - ### serialize

    public static byte[] serialize(Object object)
    Deprecated.

  - ### serialize

    public static void serialize(Object object, OutputStream outputStream)
    Deprecated.

  - ### last

    public static <T> Comparator<T> last(Comparator<? super T> comparator, T lastValue)
    Deprecated.

  - ### uncheckedCall

    @Nullable public static <T> T uncheckedCall(Callable<T> callable)
    Deprecated.
    Calls the given callable converting any thrown exception to an unchecked exception via `UncheckedException.throwAsUncheckedException(Throwable)`
    Type Parameters:
      `T` - Callable's return type
    Parameters:
      `callable` - The callable to call
    Returns:
      The value returned by `Callable.call()`

  - ### toEnum

    public static <T extends Enum<T>> T toEnum(Class<? extends T> enumType, Object value)
    Deprecated.

  - ### toEnumSet

    public static <T extends Enum<T>> EnumSet<T> toEnumSet(Class<T> enumType, Object[] values)
    Deprecated.

  - ### toEnumSet

    public static <T extends Enum<T>> EnumSet<T> toEnumSet(Class<T> enumType, Iterable<?> values)
    Deprecated.

  - ### endsWith

    public static boolean endsWith(CharSequence longer, CharSequence shorter)
    Deprecated.
    Checks whether the fist `CharSequence` ends with the second. If the `CharSequence.charAt(int)` method of both sequences is fast, this check is faster than converting them to Strings and using `String.endsWith(String)`.

  - ### toSecureUrl

    public static URI toSecureUrl(URI scriptUri)
    Deprecated.

  - ### isSecureUrl

    public static boolean isSecureUrl(URI url)
    Deprecated.