前言
经常要判断传入的参数是否为空,或者对数组、集合进行一些操作:排序、反转
ArrayUtils
import org.apache.commons.lang3.ArrayUtils;
判断数组/集合为空
https://www.cnblogs.com/onedir/p/4842828.html
Arrays
import java.util.Arrays;
- equals(array1,array2)
- sort(array)
- toString(array)
- fill(array,val)
- binarySearch(array,val)
- copyof(array,length)
https://blog.csdn.net/xuehyunyu/article/details/76695576
反转数组元素
public void invertUsingCollectionsReverse(Object[] array) {
List<Object> list = Arrays.asList(array);
Collections.reverse(list);
}
https://blog.csdn.net/neweastsun/article/details/79935638