Java Array Add addArray(Object[][] first, Object[][]... more)

Here you can find the source of addArray(Object[][] first, Object[][]... more)

Description

add Array

License

Open Source License

Declaration

public static Object[][] addArray(Object[][] first, Object[][]... more) 

Method Source Code

//package com.java2s;
/**************************************************************************************
 * Copyright (C) 2008 EsperTech, Inc. All rights reserved.                            *
 * http://esper.codehaus.org                                                          *
 * http://www.espertech.com                                                           *
 * ---------------------------------------------------------------------------------- *
 * The software in this package is published under the terms of the GPL license       *
 * a copy of which has been included with this distribution in the license.txt file.  *
 **************************************************************************************/

public class Main {
    public static Object[][] addArray(Object[][] first, Object[][]... more) {
        int len = first.length;
        for (int i = 0; i < more.length; i++) {
            Object[][] next = more[i];
            len += next.length;/*from w ww  .  j  a  va  2 s.c o m*/
        }

        Object[][] result = new Object[len][];
        int count = 0;
        for (int i = 0; i < first.length; i++) {
            result[count] = first[i];
            count++;
        }

        for (int i = 0; i < more.length; i++) {
            Object[][] next = more[i];
            for (int j = 0; j < next.length; j++) {
                result[count] = next[j];
                count++;
            }
        }

        return result;
    }
}

Related

  1. addArray(double[] array1, double[] array2)
  2. addArray(int[] a, int p)
  3. addArray(int[] a, int[] b)
  4. addArray(Object[] Old, Object[] New)
  5. addArray(StringBuffer RCode, String name, T[] array, boolean useEquals, boolean isString)
  6. addArrayAll(byte[] array1, byte[] array2)
  7. addArrayElements(byte[] toArray, byte[] fromArray)
  8. addArrays(final int[] a, final int[] b)