add a useful operation to ArrayHelper
Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
c86f151b7f
commit
cdaee09fba
|
@ -22,10 +22,19 @@ import org.hibernate.type.Type;
|
|||
|
||||
public final class ArrayHelper {
|
||||
|
||||
public static boolean contains(Object[] array, Object object) {
|
||||
public static <T> boolean contains(T[] array, T object) {
|
||||
return indexOf( array, object ) > -1;
|
||||
}
|
||||
|
||||
public static <T> 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 ) {
|
||||
|
|
Loading…
Reference in New Issue