/**
         * Transformer method that performs validation.
         *
         * @param paramTypes  the constructor parameter types
         * @param args  the constructor arguments
         * @return an instantiate transformer
         */
        public static Transformer getInstance(java.lang.Class[] paramTypes, Object[] args)
        {
            if (((paramTypes == null) && (args != null))
                || ((paramTypes != null) && (args == null))
                || ((paramTypes != null) && (args != null) && (paramTypes.Length != args.Length)))
            {
                throw new java.lang.IllegalArgumentException("Parameter types must match the arguments");
            }

            if (paramTypes == null || paramTypes.Length == 0)
            {
                return NO_ARG_INSTANCE;
            }
            else
            {
                paramTypes = (java.lang.Class[])paramTypes.clone();
                args = (Object[])args.clone();
            }
            return new InstantiateTransformer(paramTypes, args);
        }
        /**
         * Constructor taking an array of keys, optionally choosing whether to clone.
         * <p>
         * <b>If the array is not cloned, then it must not be modified.</b>
         * <p>
         * This method is public for performance reasons only, to avoid a clone.
         * The hashcode is calculated once here in this method.
         * Therefore, changing the array passed in would not change the hashcode but
         * would change the equals method, which is a bug.
         * <p>
         * This is the only fully safe usage of this constructor, as the object array
         * is never made available in a variable:
         * <pre>
         * new MultiKey(new Object[] {...}, false);
         * </pre>
         * <p>
         * The keys should be immutable
         * If they are not then they must not be changed after adding to the MultiKey.
         *
         * @param keys  the array of keys, not null
         * @param makeClone  true to clone the array, false to assign it
         * @throws IllegalArgumentException if the key array is null
         * @since Commons Collections 3.1
         */
        public MultiKey(Object[] keys, bool makeClone)
            : base()
        {
            if (keys == null)
            {
                throw new java.lang.IllegalArgumentException("The array of keys must not be null");
            }
            if (makeClone)
            {
                this.keys = (Object[])keys.clone();
            }
            else
            {
                this.keys = keys;
            }

            int total = 0;
            for (int i = 0; i < keys.Length; i++)
            {
                if (keys[i] != null)
                {
                    total ^= keys[i].GetHashCode();
                }
            }
            hashCodeJ = total;
        }
        /**
         * Factory method that performs validation.
         *
         * @param classToInstantiate  the class to instantiate, not null
         * @param paramTypes  the constructor parameter types
         * @param args  the constructor arguments
         * @return a new instantiate factory
         */
        public static Factory getInstance(java.lang.Class classToInstantiate, java.lang.Class[] paramTypes, Object[] args)
        {
            if (classToInstantiate == null)
            {
                throw new java.lang.IllegalArgumentException("Class to instantiate must not be null");
            }
            if (((paramTypes == null) && (args != null))
                || ((paramTypes != null) && (args == null))
                || ((paramTypes != null) && (args != null) && (paramTypes.Length != args.Length)))
            {
                throw new java.lang.IllegalArgumentException("Parameter types must match the arguments");
            }

            if (paramTypes == null || paramTypes.Length == 0)
            {
                return new InstantiateFactory(classToInstantiate);
            }
            else
            {
                paramTypes = (java.lang.Class[])paramTypes.clone();
                args = (Object[])args.clone();
                return new InstantiateFactory(classToInstantiate, paramTypes, args);
            }
        }