Package: org.codehaus.groovy.runtime

## [Java] Class DefaultGroovyMethodsSupport

- org.codehaus.groovy.runtime.DefaultGroovyMethodsSupport

-     public class DefaultGroovyMethodsSupport
      extends Object

  Support methods for DefaultGroovyMethods and PluginDefaultMethods.

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `<T>` | `protected static Collection<T>` | `cloneSimilarCollection(Collection<T> orig, int newCapacity)`
    `<K, V>` | `protected static Map<K, V>` | `cloneSimilarMap(Map<K, V> orig)`
    `` | `public static void` | `closeQuietly(Closeable c)` Closes the Closeable, ignoring any problems that might occur.
    `` | `public static void` | `closeWithWarning(Closeable closeable)` Close the Closeable.
    `<T>` | `protected static T[]` | `createSimilarArray(T[] orig, int newCapacity)`
    `<T>` | `protected static Collection<T>` | `createSimilarCollection(Iterable<T> iterable)`
    `<T>` | `protected static Collection<T>` | `createSimilarCollection(Collection<T> collection)`
    `<T>` | `protected static Collection<T>` | `createSimilarCollection(Collection<T> orig, int newCapacity)`
    `<T>` | `protected static List<T>` | `createSimilarList(List<T> orig, int newCapacity)`
    `<K, V>` | `protected static Map<K, V>` | `createSimilarMap(Map<K, V> orig)`
    `` | `protected static Collection` | `createSimilarOrDefaultCollection(Object object)`
    `<T>` | `protected static Queue<T>` | `createSimilarQueue(Queue<T> orig)`
    `<T>` | `protected static Set<T>` | `createSimilarSet(Set<T> orig)`
    `` | `protected static int` | `normaliseIndex(int i, int size)` Converts a possibly negative index to a real index into the array.
    `` | `protected static boolean` | `sameType(Collection[] cols)` Determines if all items of given array are of the same type.
    `` | `protected static boolean` | `sameType(Iterable[] iters)` Determines if all items of given array are of the same type.
    `` | `protected static RangeInfo` | `subListBorders(int size, Range range)` Helper method for getAt and putAt.
    `` | `protected static RangeInfo` | `subListBorders(int size, EmptyRange range)` Helper method for getAt and putAt.
    `` | `protected static IntRange` | `subListRange(RangeInfo info, IntRange range)` Helper method for primitive array getAt.
    `` | `protected static void` | `writeUTF16BomIfRequired(Writer writer, String charset)`
    `` | `protected static void` | `writeUTF16BomIfRequired(Writer writer, Charset charset)`
    `` | `protected static void` | `writeUTF16BomIfRequired(OutputStream stream, String charset)`
    `` | `protected static void` | `writeUTF16BomIfRequired(OutputStream stream, Charset charset)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll`

- - ### Method Detail

    - #### <T> protected static Collection<T> cloneSimilarCollection(Collection<T> orig, int newCapacity)

    - #### <K, V> protected static Map<K, V> cloneSimilarMap(Map<K, V> orig)

    - #### public static void closeQuietly(Closeable c)

      Closes the Closeable, ignoring any problems that might occur.

      Parameters:
        `c` - the thing to close

    - #### public static void closeWithWarning(Closeable closeable)

      Close the Closeable. Logging a warning if any problems occur.

      Parameters:
        `closeable` - the thing to close

    - #### <T> @SuppressWarnings("unchecked")
      protected static T[] createSimilarArray(T[] orig, int newCapacity)

    - #### <T> protected static Collection<T> createSimilarCollection(Iterable<T> iterable)

    - #### <T> protected static Collection<T> createSimilarCollection(Collection<T> collection)

    - #### <T> protected static Collection<T> createSimilarCollection(Collection<T> orig, int newCapacity)

    - #### <T> protected static List<T> createSimilarList(List<T> orig, int newCapacity)

    - #### <K, V> protected static Map<K, V> createSimilarMap(Map<K, V> orig)

    - #### protected static Collection createSimilarOrDefaultCollection(Object object)

    - #### <T> protected static Queue<T> createSimilarQueue(Queue<T> orig)

    - #### <T> protected static Set<T> createSimilarSet(Set<T> orig)

    - #### protected static int normaliseIndex(int i, int size)

      Converts a possibly negative index to a real index into the array.

      Parameters:
        `i` - the unnormalized index
        `size` - the array size
      Returns:
        the normalised index

    - #### protected static boolean sameType(Collection[] cols)

      Determines if all items of given array are of the same type.

      Parameters:
        `cols` - an array of collections
      Returns:
        true if the collections are all of the same type

    - #### protected static boolean sameType(Iterable[] iters)

      Determines if all items of given array are of the same type.

    - #### protected static RangeInfo subListBorders(int size, Range range)

      Helper method for getAt and putAt.

    - #### protected static RangeInfo subListBorders(int size, EmptyRange range)

      Helper method for getAt and putAt.

    - #### protected static IntRange subListRange(RangeInfo info, IntRange range)

      Helper method for primitive array getAt.

    - #### protected static void writeUTF16BomIfRequired(Writer writer, String charset)

    - #### protected static void writeUTF16BomIfRequired(Writer writer, Charset charset)

    - #### protected static void writeUTF16BomIfRequired(OutputStream stream, String charset)

    - #### protected static void writeUTF16BomIfRequired(OutputStream stream, Charset charset)