Package com.tailf.util
Class ArrayTool
Object
com.tailf.util.ArrayTool
Tools for array manipulation.
- 
Method Summary
Modifier and TypeMethodDescriptionstatic Object[]concatArrays(Object[] a, Object o) Appends an object to the end of an array, creating a new array.static Object[]concatArrays(Object[] a, Object[] b) Concatenates two arrays into a new array.static <T> T[]copyOfRange(T[] original, int from, int to) Returns a subarray from theoriginalarray fromfromtoto. 
- 
Method Details
- 
concatArrays
Concatenates two arrays into a new array.- Parameters:
 a- first array to concatenateb- second array to concatenate- Returns:
 - new array containing elements from both arrays
 
 - 
copyOfRange
public static <T> T[] copyOfRange(T[] original, int from, int to) Returns a subarray from theoriginalarray fromfromtoto. Copies the specified range of the specified array into a new array.The initial index of the range (
from) must lie between zero andoriginal.length, inclusive. The value atoriginal[from]is placed into the initial element of the copy (unlessfrom == original.lengthorfrom == to).Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (
to), which must be greater than or equal tofrom, may be greater thanoriginal.length, in which casenullis placed in all elements of the copy whose index is greater than or equal tooriginal.length - from. The length of the returned array will beto - from.The resulting array is of exactly the same class as the original array.
- Type Parameters:
 T- the type of array elements- Parameters:
 original- the array from which a range is to be copiedfrom- the initial index of the range to be copied, inclusiveto- the final index of the range to be copied, exclusive. (This index may lie outside the array.)- Returns:
 - a new array containing the specified range from the original array, truncated or padded with nulls to obtain the required length
 - Throws:
 ArrayIndexOutOfBoundsException- iffrom < 0orfrom > original.lengthIllegalArgumentException- iffrom > toNullPointerException- iforiginalis null
 - 
concatArrays
Appends an object to the end of an array, creating a new array.- Parameters:
 a- source arrayo- object to append- Returns:
 - new array with the object appended
 
 
 -