GUtil (Gradle API 8.11.1)

Package org.gradle.util

## Class GUtil

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

-     @Deprecated
      public class GUtil
      extends java.lang.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

    All Methods Static Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static <K,​V> java.util.Map<K,​V>` | `addMaps​(java.util.Map<K,​V> map1, java.util.Map<K,​V> map2)` | Deprecated.
    `static <V,​T extends java.util.Collection<? super V>> T` | `addToCollection​(T dest, boolean failOnNull, java.lang.Iterable<? extends V> src)` | Deprecated.
    `static <V,​T extends java.util.Collection<? super V>> T` | `addToCollection​(T dest, boolean failOnNull, java.lang.Iterable<? extends V>... srcs)` | Deprecated.
    `static <V,​T extends java.util.Collection<? super V>> T` | `addToCollection​(T dest, java.lang.Iterable<? extends V> src)` | Deprecated.
    `static <V,​T extends java.util.Collection<? super V>> T` | `addToCollection​(T dest, java.lang.Iterable<? extends V>... srcs)` | Deprecated.
    `static void` | `addToMap​(java.util.Map<java.lang.String,​java.lang.String> dest, java.util.Map<?,​?> src)` | Deprecated.
    `static java.lang.String` | `asPath​(java.lang.Iterable<?> collection)` | Deprecated.
    `static java.util.Comparator<java.lang.String>` | `caseInsensitive()` | Deprecated.
    `static java.util.Collection<?>` | `collectionize​(java.lang.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​(java.lang.CharSequence longer, java.lang.CharSequence shorter)` | Deprecated. Checks whether the fist `CharSequence` ends with the second.
    `static <T extends java.util.Collection<?>> T` | `flatten​(java.lang.Object[] elements, T addTo)` | Deprecated.
    `static <T extends java.util.Collection<?>> T` | `flatten​(java.lang.Object[] elements, T addTo, boolean flattenMaps)` | Deprecated.
    `static <T extends java.util.Collection<?>> T` | `flatten​(java.util.Collection<?> elements, T addTo)` | Deprecated.
    `static <T extends java.util.Collection<?>> T` | `flatten​(java.util.Collection<?> elements, T addTo, boolean flattenMapsAndArrays)` | Deprecated.
    `static <T extends java.util.Collection<?>> T` | `flatten​(java.util.Collection<?> elements, T addTo, boolean flattenMaps, boolean flattenArrays)` | Deprecated.
    `static java.util.List<java.lang.Object>` | `flatten​(java.util.Collection<java.lang.Object> elements)` | Deprecated.
    `static java.util.List<java.lang.Object>` | `flatten​(java.util.Collection<java.lang.Object> elements, boolean flattenMapsAndArrays)` | Deprecated.
    `static <T extends java.util.Collection<?>> T` | `flattenElements​(java.lang.Object... elements)` | Deprecated.
    `static <T> T` | `getOrDefault​(T object, org.gradle.internal.Factory<T> defaultValueSupplier)` | Deprecated.
    `static boolean` | `isSecureUrl​(java.net.URI url)` | Deprecated.
    `static boolean` | `isTrue​(java.lang.Object object)` | Deprecated.
    `static <T> java.util.Comparator<T>` | `last​(java.util.Comparator<? super T> comparator, T lastValue)` | Deprecated.
    `static java.util.Properties` | `loadProperties​(java.io.File propertyFile)` | Deprecated.
    `static java.util.Properties` | `loadProperties​(java.io.InputStream inputStream)` | Deprecated.
    `static java.util.Properties` | `loadProperties​(java.net.URL url)` | Deprecated.
    `static java.util.Map<java.lang.Object,​java.lang.Object>` | `map​(java.lang.Object... objects)` | Deprecated.
    `static java.util.List<java.lang.String>` | `prefix​(java.lang.String prefix, java.util.Collection<java.lang.String> strings)` | Deprecated.
    `static void` | `saveProperties​(java.util.Properties properties, java.io.File propertyFile)` | Deprecated.
    `static void` | `saveProperties​(java.util.Properties properties, java.io.OutputStream outputStream)` | Deprecated.
    `static byte[]` | `serialize​(java.lang.Object object)` | Deprecated.
    `static void` | `serialize​(java.lang.Object object, java.io.OutputStream outputStream)` | Deprecated.
    `static java.lang.String` | `toCamelCase​(java.lang.CharSequence string)` | Deprecated. Converts an arbitrary string to a camel-case string which can be used in a Java identifier.
    `static java.lang.String` | `toConstant​(java.lang.CharSequence string)` | Deprecated. Converts an arbitrary string to upper case identifier with words separated by _.
    `static <T extends java.lang.Enum<T>> T` | `toEnum​(java.lang.Class<? extends T> enumType, java.lang.Object value)` | Deprecated.
    `static <T extends java.lang.Enum<T>> java.util.EnumSet<T>` | `toEnumSet​(java.lang.Class<T> enumType, java.lang.Iterable<?> values)` | Deprecated.
    `static <T extends java.lang.Enum<T>> java.util.EnumSet<T>` | `toEnumSet​(java.lang.Class<T> enumType, java.lang.Object[] values)` | Deprecated.
    `static java.lang.String` | `toLowerCamelCase​(java.lang.CharSequence string)` | Deprecated.
    `static java.net.URI` | `toSecureUrl​(java.net.URI scriptUri)` | Deprecated.
    `static java.lang.String` | `toString​(java.lang.Iterable<?> names)` | Deprecated.
    `static java.lang.String` | `toWords​(java.lang.CharSequence string)` | Deprecated. Converts an arbitrary string to space-separated words.
    `static java.lang.String` | `toWords​(java.lang.CharSequence string, char separator)` | Deprecated.
    `static <T> T` | `uncheckedCall​(java.util.concurrent.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 Detail

    - #### GUtil

          public GUtil()

      Deprecated.

  - ### Method Detail

    - #### flatten

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

      Deprecated.

    - #### flatten

          public static <T extends java.util.Collection<?>> T flatten​(java.lang.Object[] elements,
                                                                      T addTo)

      Deprecated.

    - #### flatten

          public static <T extends java.util.Collection<?>> T flatten​(java.util.Collection<?> elements,
                                                                      T addTo)

      Deprecated.

    - #### flattenElements

          public static <T extends java.util.Collection<?>> T flattenElements​(java.lang.Object... elements)

      Deprecated.

    - #### flatten

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

      Deprecated.

    - #### flatten

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

      Deprecated.

    - #### collectionize

          public static java.util.Collection<?> collectionize​(java.lang.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 java.util.List<java.lang.Object> flatten​(java.util.Collection<java.lang.Object> elements,
                                                                 boolean flattenMapsAndArrays)

      Deprecated.

    - #### flatten

          public static java.util.List<java.lang.Object> flatten​(java.util.Collection<java.lang.Object> elements)

      Deprecated.

    - #### asPath

          public static java.lang.String asPath​(java.lang.Iterable<?> collection)

      Deprecated.

    - #### prefix

          public static java.util.List<java.lang.String> prefix​(java.lang.String prefix,
                                                                java.util.Collection<java.lang.String> strings)

      Deprecated.

    - #### isTrue

          public static boolean isTrue​(@Nullable
                                       java.lang.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 java.util.Collection<? super V>> T addToCollection​(T dest,
                                                                                              boolean failOnNull,
                                                                                              java.lang.Iterable<? extends V> src)

      Deprecated.

    - #### addToCollection

          public static <V,​T extends java.util.Collection<? super V>> T addToCollection​(T dest,
                                                                                              java.lang.Iterable<? extends V> src)

      Deprecated.

    - #### addToCollection

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

      Deprecated.

    - #### addToCollection

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

      Deprecated.

    - #### caseInsensitive

          public static java.util.Comparator<java.lang.String> caseInsensitive()

      Deprecated.

    - #### addMaps

          public static <K,​V> java.util.Map<K,​V> addMaps​(java.util.Map<K,​V> map1,
                                                                     java.util.Map<K,​V> map2)

      Deprecated.

    - #### addToMap

          public static void addToMap​(java.util.Map<java.lang.String,​java.lang.String> dest,
                                      java.util.Map<?,​?> src)

      Deprecated.

    - #### loadProperties

          public static java.util.Properties loadProperties​(java.io.File propertyFile)

      Deprecated.

    - #### loadProperties

          public static java.util.Properties loadProperties​(java.net.URL url)

      Deprecated.

    - #### loadProperties

          public static java.util.Properties loadProperties​(java.io.InputStream inputStream)

      Deprecated.

    - #### saveProperties

          public static void saveProperties​(java.util.Properties properties,
                                            java.io.File propertyFile)

      Deprecated.

    - #### saveProperties

          public static void saveProperties​(java.util.Properties properties,
                                            java.io.OutputStream outputStream)

      Deprecated.

    - #### map

          public static java.util.Map<java.lang.Object,​java.lang.Object> map​(java.lang.Object... objects)

      Deprecated.

    - #### toString

          public static java.lang.String toString​(java.lang.Iterable<?> names)

      Deprecated.

    - #### toCamelCase

          public static java.lang.String toCamelCase​(java.lang.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 java.lang.String toLowerCamelCase​(java.lang.CharSequence string)

      Deprecated.

    - #### toConstant

          public static java.lang.String toConstant​(java.lang.CharSequence string)

      Deprecated.
      Converts an arbitrary string to upper case identifier with words separated by _. Eg, camelCase -> CAMEL_CASE

    - #### toWords

          public static java.lang.String toWords​(java.lang.CharSequence string)

      Deprecated.
      Converts an arbitrary string to space-separated words. Eg, camelCase -> camel case, with_underscores -> with underscores

    - #### toWords

          public static java.lang.String toWords​(java.lang.CharSequence string,
                                                 char separator)

      Deprecated.

    - #### serialize

          public static byte[] serialize​(java.lang.Object object)

      Deprecated.

    - #### serialize

          public static void serialize​(java.lang.Object object,
                                       java.io.OutputStream outputStream)

      Deprecated.

    - #### last

          public static <T> java.util.Comparator<T> last​(java.util.Comparator<? super T> comparator,
                                                         T lastValue)

      Deprecated.

    - #### uncheckedCall

          @Nullable
          public static <T> T uncheckedCall​(java.util.concurrent.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 java.lang.Enum<T>> T toEnum​(java.lang.Class<? extends T> enumType,
                                                               java.lang.Object value)

      Deprecated.

    - #### toEnumSet

          public static <T extends java.lang.Enum<T>> java.util.EnumSet<T> toEnumSet​(java.lang.Class<T> enumType,
                                                                                     java.lang.Object[] values)

      Deprecated.

    - #### toEnumSet

          public static <T extends java.lang.Enum<T>> java.util.EnumSet<T> toEnumSet​(java.lang.Class<T> enumType,
                                                                                     java.lang.Iterable<?> values)

      Deprecated.

    - #### endsWith

          public static boolean endsWith​(java.lang.CharSequence longer,
                                         java.lang.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 java.net.URI toSecureUrl​(java.net.URI scriptUri)

      Deprecated.

    - #### isSecureUrl

          public static boolean isSecureUrl​(java.net.URI url)

      Deprecated.