add array's functions to UiCollection

This commit is contained in:
hyb1996
2017-11-01 23:52:16 +08:00
parent a30019ab77
commit 935a82099c
8 changed files with 314 additions and 26 deletions

View File

@@ -1,5 +1,6 @@
package com.stardust.util;
import java.lang.reflect.Array;
import java.util.List;
/**
@@ -34,4 +35,12 @@ public class ArrayUtils {
}
return str;
}
@SuppressWarnings("unchecked")
public static <T> T[] merge(T[] a1, T[] a2) {
T[] a = (T[]) Array.newInstance(a1.getClass().getComponentType(), a1.length + a2.length);
System.arraycopy(a1, 0, a, 0, a1.length);
System.arraycopy(a2, 0, a, a1.length, a2.length);
return a;
}
}