Class DefaultGroovyMethodsSupport

    • Constructor Detail

      • DefaultGroovyMethodsSupport

        public DefaultGroovyMethodsSupport()
    • Method Detail

      • normaliseIndex

        protected static int normaliseIndex​(int i,
                                            int size)
        This converts a possibly negative index to a real index into the array.
        Parameters:
        i - the unnormalised index
        size - the array size
        Returns:
        the normalised index
      • closeWithWarning

        public static void closeWithWarning​(java.io.Closeable c)
        Close the Closeable. Logging a warning if any problems occur.
        Parameters:
        c - the thing to close
      • closeQuietly

        public static void closeQuietly​(java.io.Closeable c)
        Close the Closeable. Ignore any problems that might occur.
        Parameters:
        c - the thing to close
      • cloneSimilarCollection

        protected static <T> java.util.Collection<T> cloneSimilarCollection​(java.util.Collection<T> orig,
                                                                            int newCapacity)
      • createSimilarOrDefaultCollection

        protected static java.util.Collection createSimilarOrDefaultCollection​(java.lang.Object object)
      • createSimilarCollection

        protected static <T> java.util.Collection<T> createSimilarCollection​(java.util.Collection<T> collection)
      • createSimilarCollection

        protected static <T> java.util.Collection<T> createSimilarCollection​(java.util.Collection<T> orig,
                                                                             int newCapacity)
      • createSimilarList

        protected static <T> java.util.List<T> createSimilarList​(java.util.List<T> orig,
                                                                 int newCapacity)
      • createSimilarArray

        protected static <T> T[] createSimilarArray​(T[] orig,
                                                    int newCapacity)
      • createSimilarSet

        protected static <T> java.util.Set<T> createSimilarSet​(java.util.Set<T> orig)
      • createSimilarMap

        protected static <K,​V> java.util.Map<K,​V> createSimilarMap​(java.util.Map<K,​V> orig)
      • cloneSimilarMap

        protected static <K,​V> java.util.Map<K,​V> cloneSimilarMap​(java.util.Map<K,​V> orig)
      • sameType

        protected static boolean sameType​(java.util.Collection[] cols)
        Determines if all items of this array are of the same type.
        Parameters:
        cols - an array of collections
        Returns:
        true if the collections are all of the same type