List of utility methods to do Array Merge
byte[] | mergeByteArrays(byte[] one, byte[] two) merge Byte Arrays byte[] result = new byte[one.length + two.length]; System.arraycopy(one, 0, result, 0, one.length); System.arraycopy(two, 0, result, one.length, two.length); return result; |
byte[] | mergeBytearrays(byte[] ret, byte[] header, byte[] body) merge Bytearrays System.arraycopy(header, 0, ret, 0, header.length);
System.arraycopy(body, 0, ret, header.length, body.length);
return ret;
|
char[] | mergeCharArrays(char[] array1, char[] array2) Simple method to merge two character arrays. char[] result = new char[array1.length + array2.length]; int count = 0; for (int i = 0; i < array1.length; i++) { result[count] = array1[i]; count++; for (int i = 0; i < array2.length; i++) { result[count] = array2[i]; ... |
int[] | mergeColumnsSafely(int[] arrOriginalColumns, int[] arrExtraColumns) Merge new columns to the list of existing columns safely so if they already exist in the original list, they won't be added. int[] arrReturn = arrOriginalColumns; List lstAddedColumns = new ArrayList(); int iIndex; int iIndex1; Integer iColumn; boolean bFoundFlag; for (iIndex = 0; iIndex < arrExtraColumns.length; iIndex++) { bFoundFlag = false; ... |
String[] | mergeNoDuplicates(String[] in1, String[] in2) merge No Duplicates Set holder = new HashSet(); if (in1 != null) { for (int i = 0; i < in1.length; i++) { holder.add(in1[i]); if (in2 != null) { for (int i = 0; i < in2.length; i++) { ... |
String | mergeParameterVariableNameDescription(String[] parameterType, String[] variableName) merge Parameter Variable Name Description if (parameterType == null && variableName == null) { return EMPTY_ARRAY; if (variableName != null && parameterType != null) { if (parameterType.length != variableName.length) { throw new IllegalArgumentException("args size not equal"); if (parameterType.length == 0) { ... |
String | mergerBy(String[] target, String seperator) merger By if (null == target) { return null; StringBuilder sb = new StringBuilder(256); for (String str : target) { sb.append(str); sb.append(seperator); return sb.substring(0, sb.lastIndexOf(seperator)); |
void | mergeSort(Object[] src, Object[] dest, int low, int high, int off) Src is the source array that starts at index 0 Dest is the (possibly larger) array destination with a possible offset low is the index in dest to start sorting high is the end index in dest to end sorting off is the offset to generate corresponding low, high in src To be removed in a future release. int length = high - low; if (length < INSERTIONSORT_THRESHOLD) { for (int i = low; i < high; i++) for (int j = i; j > low && ((Comparable) dest[j - 1]).compareTo(dest[j]) > 0; j--) swap(dest, j, j - 1); return; int destLow = low; ... |
void | mergeSort(Object[] src, Object[] dest, int low, int high, int off, Comparator c) Src is the source array that starts at index 0 Dest is the (possibly larger) array destination with a possible offset low is the index in dest to start sorting high is the end index in dest to end sorting off is the offset into src corresponding to low in dest int length = high - low; if (length < INSERTIONSORT_THRESHOLD) { for (int i = low; i < high; i++) for (int j = i; j > low && c.compare(dest[j - 1], dest[j]) > 0; j--) swap(dest, j, j - 1); return; int destLow = low; ... |
String[] | mergeSortArrays(String[][] arrayArray) Returns a new array which merges, sorts, and removes duplicates from the elements of the arrays contained in the given array (of arrays). String[] mergedArray = null; int arrayCount = arrayArray.length; if (arrayCount > 0) { String[] tempArray = arrayArray[0]; List tempList = Arrays.asList(tempArray); List mergedList = new ArrayList(tempList); for (int i = 1; i < arrayCount; i++) { tempArray = arrayArray[i]; ... |