From 248048f9f3db165aec8004f708c33331c956e2ef Mon Sep 17 00:00:00 2001 From: qi_liang Date: Fri, 20 Sep 2019 20:38:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0ArrayUtil=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=B1=BB=E5=92=8C=E6=B5=8B=E8=AF=95=E6=96=B9=E6=B3=95=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/lq/code/util/ArrayUtil.java | 20 +++++++++++++++++ .../java/com/lq/code/util/ArrayUtilTest.java | 22 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/main/java/com/lq/code/util/ArrayUtil.java create mode 100644 src/test/java/com/lq/code/util/ArrayUtilTest.java 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