Merge arrays

@param array The source arrays
@return A collection that contains the contents of all the arrays passed to <code>array</code>
968816
public static <T> ArrayList<T> mergeLists(final T... array) {
        final ArrayList<T> retValue = new ArrayList<T>();
        Collections.addAll(retValue, array);
        return retValue;
    }
1127258
public static function merge($arrays)
    {
        $merged = [];

        foreach ($arrays as $array)
        {
            $merged = array_merge($merged, static::flatten($array));
        }

        return static::expand($merged);
    }
760565
function mergeArray(a, b) {
  var adds = [];
  var ai = 0;

  for (var i = 0; i < b.length; i++) {
    if (('object' === type(a[i]) && 'object' === type(b[i]))
    ||  ('array' === type(a[i]) && 'array' === type(b[i]))) {
      a[i] = merge(a[i], b[i]);
    } else if ('object' === type(b[i])) {
      adds.push(merge({}, b[i]));
    } else if ('array' === type(b[i])) {
      adds.push(merge([], b[i]));
    } else if (!~a.indexOf(b[i])) {
      adds.push(b[i]);
    }
  }

  for (; ai < adds.length; ai++) {
    a.push(adds[ai]);
  }

  return a;
}
873710
function mergeDeepArrays(array1, array2) {
  const length = Math.max(array1.length, array2.length);

  let index = -1,
      mergedArray = [];

  while (++index < length) {
    if (index < array2.length) {
      mergedArray[index] = getDeeplyMergedValues(array1[index], array2[index]);

      continue;
    }

    mergedArray[index] = array1[index];
  }

  return mergedArray;
}
562094
private function mergeArrays($deep, $array1, $array2)
    {
        if ($deep === 'merge') {
            return Utils::arrayMergeRecursiveUnique($array1, $array2);
        }
        if ($deep === true) {
            return array_replace_recursive($array1, $array2);
        }

        return array_merge($array1, $array2);
    }
986020
private static String joinString(String[] array) {
    StringBuilder sb = new StringBuilder();
    for (String value : array) {
      if (sb.length() > 0) {
        sb.append(" ");
      }
      sb.append(value);
    }
    return sb.toString();
  }
198731
protected function mergeResourceArrays(...$arrays) : ?array
    {
        $merged = [];

        foreach ($arrays as $array) {
            if (!is_array($array)) {
                continue;
            }

            /** @var ResourceSettings $resource */
            foreach ($array as $resource) {
                $this->mergeWithOrder($resource, $merged);
            }
        }

        return !empty($merged) ? $merged : null;
    }
1223825
public static function Merge(array $array1 = null, array $array2 = null){

		//check for the existance of the implementation class
		self::setImplmentationClass();

		//set the input parameters in a try...catch block for better error handling
		try {

			//set the value fo the $inputArray1 parameter
			$array1 = ( ! is_null($array1)) ? $array1 : self::$ArrayHelperClassInstance->getOutputElement();
			
			//set the value fo the $inputArray2 parameter
			$array2 = ( ! is_null($array2)) ? $array2 : self::$ArrayHelperClassInstance->getOutputElement();

			//check if null was supplied for the $key parameter
			if($array === null) throw new ArrayHelperException("NULL \$array1 value passed to ArrayHelper::Merge() method which merges the elements of two arrays. A valid array1 is expected!", 1);

			//check if null value was set for the inputArray paramter
			if($array2 === null) throw new ArrayHelperException("NULL \$array2 value passed to ArrayHelper::Merge() method which merges the elements of two arrays. A valid array2 is expected!", 1);
			
			//call the implementation class to merge the input array
			self::$ArrayHelperClassInstance->Merge($array1, $array2);

			//return the static instance
			return new static;

		} 

		//catch the error messages here
		catch (ArrayHelperException $ArrayHelperExceptionInstance) {

			//diplay the error message
			$ArrayHelperExceptionInstance->errorShow();
			
		}
	}
893948
public ToStringBuilder append(final Object[] array) {
        style.append(buffer, null, array, null);
        return this;
    }
1332324
public static function mergeSort($array): array
    {
        if (count($array) === 1) {
            return $array;
        }

        $middle = (int)round(count($array) / 2);
        $left = array_slice($array, 0, $middle);
        $right = array_slice($array, $middle);

        $left = self::mergeSort($left);
        $right = self::mergeSort($right);

        return self::merge($left, $right);
    }
358595
public static ArrayList<String> toList( String[] array )
	{
		if( array == null )
		{
			return new ArrayList<String>( 0 );
		}
		ArrayList<String> list = new ArrayList<String>( array.length );
		for (String s : array)
		{
			list.add( s );
		}
		return list;
	}
1327913
public static String join(String[] array) {
    return array == null ? null : join(asList(array));
  }
242805
@Nonnull
  @MayContainNull
  @Weight(Weight.Unit.NORMAL)
  public static <T> T[] joinArrays(@MayContainNull final T[]... arrays) {
    int commonLength = 0;
    for (final T[] array : arrays) {
      if (array != null) {
        commonLength += array.length;
      }
    }
    @SuppressWarnings("unchecked")
    final T[] result = (T[]) Array.newInstance(arrays.getClass().getComponentType().getComponentType(), commonLength);
    int position = 0;
    for (final T[] array : arrays) {
      if (array != null) {
        System.arraycopy(array, 0, result, position, array.length);
        position += array.length;
      }
    }
    return result;
  }
747963
private function mergeArray($destinationArray, $sourceArray)
    {
        $result = array();
        foreach ($destinationArray as $key => $destinationArrayItem) {
            if (is_int($key)) {
                $result[] = $destinationArrayItem;
            } else {
                $result[$key] = $destinationArrayItem;
            }
        }

        foreach ($sourceArray as $key => $sourceArrayItem) {
            if (is_int($key)) {
                $result[] = $sourceArrayItem;
            } else {
                $result[$key] = $this->run($result[$key], $sourceArrayItem);
            }
        }

        return $result;
    }
373152
public function merge($array)
    {

        if (is_array($array)) {
            $this->storage = array_merge(
                $this->storage,
                $array
            );
        } elseif ($array instanceof Collection) {
            $this->storage = array_merge(
                $this->storage,
                $array->toArray()
            );
        } else {
            throw new \ErrorException(
                'Must be take 1 parameter to be array or Collection',
                E_ERROR
            );
        }

        return $this;
    }
465121
public function merge(ArrayObjectA $Array) {
		$this->exchangeArray(array_merge($this->getArrayCopy(), $Array->getArrayCopy()));
		return $this;
	}
395478
public static <T> List<T> toList(T[] array) {
        return new ArrayList<T>(Arrays.asList(array));
    }