添加ArrayUtil工具类和测试方法类

master
星期八 5 years ago
parent d1a85f5dff
commit 248048f9f3
  1. 20
      src/main/java/com/lq/code/util/ArrayUtil.java
  2. 22
      src/test/java/com/lq/code/util/ArrayUtilTest.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 <T>
* @return
*/
public static <T> T [] of(T... values){
return values;
}
}

@ -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);
}
}
Loading…
Cancel
Save