Mega Code Archive
Concatenates all the passed arrays
/*
* Copyright WizTools.org
* Licensed under the Apache License, Version 2.0:
* http://www.apache.org/licenses/LICENSE-2.0
*/
//package org.wiztools.commons;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author subwiz
*/
public final class ArrayUtil {
/**
* Determines if the passed object is of type array.
* @param o The object to determine if it is an array.
* @return true if the passed object is an array.
* @throws NullPointerException when the passed object is null.
*/
public static boolean isArray(Object o) throws NullPointerException {
if(o == null)
throw new NullPointerException("Object is null: cannot determine if it is of array type.");
else {
return o.getClass().isArray();
}
}
/**
* Concatenates all the passed parameters.
* @param
* @param objs
* @return
*/
public static T[] concat(T[] ... objs){
List out = new ArrayList();
int i = 0;
T[] pass = null;
for(T[] o: objs){
for(int j=0; j