Skip to content

Commit cdaee09

Browse files
committed
add a useful operation to ArrayHelper
Signed-off-by: Gavin King <[email protected]>
1 parent c86f151 commit cdaee09

File tree

1 file changed

+10
-1
lines changed
  • hibernate-core/src/main/java/org/hibernate/internal/util/collections

1 file changed

+10
-1
lines changed

hibernate-core/src/main/java/org/hibernate/internal/util/collections/ArrayHelper.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,19 @@
2222

2323
public final class ArrayHelper {
2424

25-
public static boolean contains(Object[] array, Object object) {
25+
public static <T> boolean contains(T[] array, T object) {
2626
return indexOf( array, object ) > -1;
2727
}
2828

29+
public static <T> boolean containsAll(T[] array, T[] elements) {
30+
for ( T element : elements ) {
31+
if ( !contains( array, element ) ) {
32+
return false;
33+
}
34+
}
35+
return true;
36+
}
37+
2938
public static boolean contains(int[] array, int value) {
3039
for ( int i = 0; i < array.length; i++ ) {
3140
if ( array[i] == value ) {

0 commit comments

Comments
 (0)