Browse Source

Utility optimization

Tankernn 8 years ago
parent
commit
65568b605c
1 changed files with 4 additions and 4 deletions
  1. 4 4
      src/main/java/util/ArrayUtil.java

+ 4 - 4
src/main/java/util/ArrayUtil.java

@@ -1,9 +1,9 @@
 package util;
 
+import java.util.Arrays;
+
 public class ArrayUtil {
-	public static String[] removeFirst(String[] oldArr) {
-		String[] newArr = new String[oldArr.length - 1];
-		System.arraycopy(oldArr, 1, newArr, 0, oldArr.length - 1);
-		return newArr;
+	public static <T> T[] removeFirst(T[] oldArr) {
+		return Arrays.copyOfRange(oldArr, 1, oldArr.length);
 	}
 }