From cdaee09fbaf65db9c0d70795c10556ed7ed7eb45 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Sat, 9 Nov 2024 21:06:58 +0100 Subject: [PATCH] add a useful operation to ArrayHelper Signed-off-by: Gavin King --- .../internal/util/collections/ArrayHelper.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/internal/util/collections/ArrayHelper.java b/hibernate-core/src/main/java/org/hibernate/internal/util/collections/ArrayHelper.java index 35f5c64e14..494be4cedf 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/util/collections/ArrayHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/util/collections/ArrayHelper.java @@ -22,10 +22,19 @@ import org.hibernate.type.Type; public final class ArrayHelper { - public static boolean contains(Object[] array, Object object) { + public static boolean contains(T[] array, T object) { return indexOf( array, object ) > -1; } + public static boolean containsAll(T[] array, T[] elements) { + for ( T element : elements ) { + if ( !contains( array, element ) ) { + return false; + } + } + return true; + } + public static boolean contains(int[] array, int value) { for ( int i = 0; i < array.length; i++ ) { if ( array[i] == value ) {