From 2947275d5470308de14c82a38e7d75b768682827 Mon Sep 17 00:00:00 2001 From: Redkale <8730487+redkale@users.noreply.github.com> Date: Wed, 18 Sep 2019 11:27:54 +0800 Subject: [PATCH] --- src/org/redkale/util/Utility.java | 54 +++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/src/org/redkale/util/Utility.java b/src/org/redkale/util/Utility.java index 59bbacf02..549a9477e 100644 --- a/src/org/redkale/util/Utility.java +++ b/src/org/redkale/util/Utility.java @@ -871,6 +871,22 @@ public final class Utility { return false; } + /** + * 判断指定值(不要包含相同的元素)是否包含指定的数组中,包含返回true + * + * @param values 集合 + * @param items 多值 + * + * @return boolean + */ + public static boolean contains(short[] values, short... items) { + if (values == null) return false; + for (short item : items) { + if (!contains(values, item)) return false; + } + return true; + } + /** * 判断指定值是否包含指定的数组中,包含返回true * @@ -887,6 +903,22 @@ public final class Utility { return false; } + /** + * 判断指定值(不要包含相同的元素)是否包含指定的数组中,包含返回true + * + * @param values 集合 + * @param items 多值 + * + * @return boolean + */ + public static boolean contains(int[] values, int... items) { + if (values == null) return false; + for (int item : items) { + if (!contains(values, item)) return false; + } + return true; + } + /** * 判断指定值是否包含指定的数组中,包含返回true * @@ -903,6 +935,22 @@ public final class Utility { return false; } + /** + * 判断指定值(不要包含相同的元素)是否包含指定的数组中,包含返回true + * + * @param values 集合 + * @param items 多值 + * + * @return boolean + */ + public static boolean contains(long[] values, long... items) { + if (values == null) return false; + for (long item : items) { + if (!contains(values, item)) return false; + } + return true; + } + /** * 判断指定值是否包含指定的数组中,包含返回true * @@ -932,8 +980,6 @@ public final class Utility { * @return 是否完全包含 */ public static boolean containsMatch(final short[] array, final short... items) { - if (array == null && items == null) return true; - if (array == null && items.length == 0) return true; if (array == null) return false; if (items == null || items.length == 0) return true; if (array.length == 0 && items.length == 0) return true; @@ -971,8 +1017,6 @@ public final class Utility { * @return 是否完全包含 */ public static boolean containsMatch(final int[] array, final int... items) { - if (array == null && items == null) return true; - if (array == null && items.length == 0) return true; if (array == null) return false; if (items == null || items.length == 0) return true; if (array.length == 0 && items.length == 0) return true; @@ -1010,8 +1054,6 @@ public final class Utility { * @return 是否完全包含 */ public static boolean containsMatch(final long[] array, final long... items) { - if (array == null && items == null) return true; - if (array == null && items.length == 0) return true; if (array == null) return false; if (items == null || items.length == 0) return true; if (array.length == 0 && items.length == 0) return true;