Browse Source

Merge pull request #24 in TC/finekit from ~ZHAOJUNZHE/finekit:master to master

* commit 'e0f727939e5304dd627e40f9b51e94556b0be570':
  update: 去除不必要的方法。
  update: 新增数组方法和参数方法并提供单测。
master
superman 5 years ago
parent
commit
9db0586460
  1. 1
      src/main/java/com/fanruan/api/cal/ParameterKit.java
  2. 11
      src/main/java/com/fanruan/api/util/ArrayKit.java
  3. 14
      src/test/java/com/fanruan/api/util/ArrayKitTest.java

1
src/main/java/com/fanruan/api/cal/ParameterKit.java

@ -108,4 +108,5 @@ public class ParameterKit {
public static ParameterProvider[] analyzeAndUnionSameParameters(String[] paramTexts, Parameter[] ps){
return ParameterHelper.analyzeAndUnionSameParameters(paramTexts, ps);
}
}

11
src/main/java/com/fanruan/api/util/ArrayKit.java

@ -2,6 +2,8 @@ package com.fanruan.api.util;
import com.fr.stable.ArrayUtils;
import java.util.List;
/**
* @author richie
* @version 10.0
@ -91,4 +93,13 @@ public class ArrayKit {
public static <T> boolean isNotEmpty(T[] array) {
return ArrayUtils.isNotEmpty(array);
}
/**
* 返回一个ArrayList
* @param array 数组
* @return 链表
* */
public static <T> List<T> toList(T[] array) {
return ArrayUtils.toList(array);
}
}

14
src/test/java/com/fanruan/api/util/ArrayKitTest.java

@ -1,6 +1,9 @@
package com.fanruan.api.util;
import com.fanruan.api.Prepare;
import java.util.*;
import com.fr.third.org.apache.poi.hssf.record.formula.functions.Int;
import org.junit.Assert;
import org.junit.Test;
@ -97,4 +100,15 @@ public class ArrayKitTest extends Prepare {
Assert.assertEquals(ArrayKit.addAll(longTestArray, 5L,6L), longTestResult);
Assert.assertEquals(ArrayKit.addAll(shortTestArray, new Short("5"),new Short("6")), shortTestResult);
}
@Test
public void toList() throws Exception{
Integer array[] = {1,2,3};
ArrayList<Integer> result = new ArrayList<Integer>();
result.add(1);
result.add(2);
result.add(3);
Assert.assertEquals(ArrayKit.toList(array),result);
}
}

Loading…
Cancel
Save