|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectcom.baidu.unbiz.fluentvalidator.util.ArrayUtil
public class ArrayUtil
数组工具类
| 构造方法摘要 | |
|---|---|
ArrayUtil()
|
|
| 方法摘要 | ||
|---|---|---|
static
|
hasIntersection(T[] from,
T[] target)
验证数组是否有交集 Class |
|
static
|
isEmpty(T[] arrary)
检查数组是否为 null或空数组[]。 |
|
static
|
toWrapperIfPrimitive(Object froms)
将数组转变成数组,如果 froms为null,则返回null。 |
|
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 构造方法详细信息 |
|---|
public ArrayUtil()
| 方法详细信息 |
|---|
public static <T> boolean isEmpty(T[] arrary)
null或空数组[]。
ArrayUtil.isEmpty(null) = true ArrayUtil.isEmpty(new int[0]) = true ArrayUtil.isEmpty(new int[10]) = false
array - 要检查的数组
true
public static <T> boolean hasIntersection(T[] from,
T[] target)
Class>[] from = new Class>[] {};
Class>[] target = new Class>[] {};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true));
from = new Class>[] {String.class};
target = new Class>[] {};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true));
from = new Class>[] {};
target = new Class>[] {String.class};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(false));
from = new Class>[] {String.class};
target = new Class>[] {String.class};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true));
from = new Class>[] {String.class, Object.class};
target = new Class>[] {String.class};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true));
from = new Class>[] {String.class};
target = new Class>[] {String.class, Object.class};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(true));
from = new Class>[] {Integer.class};
target = new Class>[] {Object.class};
assertThat(ArrayUtil.hasIntersection(from, target), Matchers.is(false));
from - 基础数组target - 目标数组,看是否存在于基础数组中
truepublic static <T> T[] toWrapperIfPrimitive(Object froms)
froms为null,则返回null。froms不为基本类型数组,则返回null
froms - 基本类型数组
froms为null,则返回null;froms不为基本类型数组,则返回null
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||