public static Object concat(Object lhs, Object rhs) throws UtilEvalError {
        Class<?> lhsType = lhs.getClass();
        Class<?> rhsType = rhs.getClass();
        if ( Types.arrayDimensions(lhsType) != Types.arrayDimensions(rhsType) )
            throw new UtilEvalError("Cannot concat arrays with inconsistent dimensions."
                + " Attempting to concat array of type " + StringUtil.typeString(lhs)
                + " with array of type " + StringUtil.typeString(rhs) + ".");
        Class<?> toType = Types.getCommonType(
                Types.arrayElementType(lhsType),
                Types.arrayElementType(rhsType));
        int[] dims = dimensions(lhs);
        dims[0] = Array.getLength(lhs) + Array.getLength(rhs);
        Object toArray = Array.newInstance(toType, dims);
        copy(toType, toArray, lhs, rhs);
        return toArray;
    }
public static Object concat ( Object lhs , Object rhs ) throws UtilEvalError { Class < ? > lhsType = lhs . getClass ( ) ; Class < ? > rhsType = rhs . getClass ( ) ; if ( Types . arrayDimensions ( lhsType ) != Types . arrayDimensions ( rhsType ) ) throw new UtilEvalError ( "Cannot concat arrays with inconsistent dimensions." + " Attempting to concat array of type " + StringUtil . typeString ( lhs ) + " with array of type " + StringUtil . typeString ( rhs ) + "." ) ; Class < ? > toType = Types . getCommonType ( Types . arrayElementType ( lhsType ) , Types . arrayElementType ( rhsType ) ) ; int [ ] dims = dimensions ( lhs ) ; dims [ 0 ] = Array . getLength ( lhs ) + Array . getLength ( rhs ) ; Object toArray = Array . newInstance ( toType , dims ) ; copy ( toType , toArray , lhs , rhs ) ; return toArray ; }
Concatenate two arrays.
@param lhs 1st array
@param rhs 2nd array
@return a new array instance of concatenated contents.
@throws UtilEvalError for inconsistent dimensions.