diff --git a/src/main/java/com/lq/code/util/ArrayUtil.java b/src/main/java/com/lq/code/util/ArrayUtil.java new file mode 100644 index 0000000..7f68585 --- /dev/null +++ b/src/main/java/com/lq/code/util/ArrayUtil.java @@ -0,0 +1,20 @@ +package com.lq.code.util; + +/** + * @Author: qi + * @Description:数组工具类 + * @Date: Create in 10:42 PM 2019/9/19 + */ +public class ArrayUtil { + + /** + * 生成数组 + * @param values + * @param + * @return + */ + public static T [] of(T... values){ + + return values; + } +} diff --git a/src/test/java/com/lq/code/util/ArrayUtilTest.java b/src/test/java/com/lq/code/util/ArrayUtilTest.java new file mode 100644 index 0000000..1fb02ad --- /dev/null +++ b/src/test/java/com/lq/code/util/ArrayUtilTest.java @@ -0,0 +1,22 @@ +package com.lq.code.util; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * @Author: qi + * @Description: + * @Date: Create in 10:44 PM 2019/9/19 + */ +public class ArrayUtilTest { + + @Test + public void of() { + + String [] strArray = ArrayUtil.of("hello","world","!"); + + Integer[] intArray = ArrayUtil.of(1,2,2,3,4,5); + + } +} \ No newline at end of file