| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ArrayUtil |
|
| 7.0;7 |
| 1 | package ca.uhn.hl7v2.util; | |
| 2 | ||
| 3 | /** | |
| 4 | * Utility methods for working with arrays | |
| 5 | */ | |
| 6 | 0 | public class ArrayUtil { |
| 7 | ||
| 8 | /** | |
| 9 | * Returns true if the array contains the given value, using | |
| 10 | * {@link Object#equals(Object)}. Checks for a null value | |
| 11 | * in the array if theValue is null. | |
| 12 | * | |
| 13 | * @param theArray the array to be checked | |
| 14 | * @param theValue value to be search for | |
| 15 | */ | |
| 16 | public static <T> boolean contains(T[] theArray, T theValue) { | |
| 17 | 0 | for (T next : theArray) { |
| 18 | 0 | if (theValue == null) { |
| 19 | 0 | if (next == null) { |
| 20 | 0 | return true; |
| 21 | } | |
| 22 | } else { | |
| 23 | 0 | if (theValue.equals(next)) { |
| 24 | 0 | return true; |
| 25 | } | |
| 26 | } | |
| 27 | } | |
| 28 | 0 | return false; |
| 29 | } | |
| 30 | ||
| 31 | } |