Operations on arrays, primitive arrays (like int[]) and primitive wrapper arrays (like Integer[]). This class tries to handle null input gracefully. An exception will not be thrown for a null array input. However, an Object array that contains a null eleme
| 59 | * @since 2.0 |
| 60 | */ |
| 61 | public class ArrayUtils { |
| 62 | |
| 63 | /** |
| 64 | * Bridge class to {@link Math} methods for testing purposes. |
| 65 | */ |
| 66 | static class MathBridge { |
| 67 | static int addExact(final int a, final int b) { |
| 68 | return Math.addExact(a, b); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * An empty immutable {@code boolean} array. |
| 74 | */ |
| 75 | public static final boolean[] EMPTY_BOOLEAN_ARRAY = {}; |
| 76 | |
| 77 | /** |
| 78 | * An empty immutable {@link Boolean} array. |
| 79 | */ |
| 80 | public static final Boolean[] EMPTY_BOOLEAN_OBJECT_ARRAY = {}; |
| 81 | |
| 82 | /** |
| 83 | * An empty immutable {@code byte} array. |
| 84 | */ |
| 85 | public static final byte[] EMPTY_BYTE_ARRAY = {}; |
| 86 | |
| 87 | /** |
| 88 | * An empty immutable {@link Byte} array. |
| 89 | */ |
| 90 | public static final Byte[] EMPTY_BYTE_OBJECT_ARRAY = {}; |
| 91 | |
| 92 | /** |
| 93 | * An empty immutable {@code char} array. |
| 94 | */ |
| 95 | public static final char[] EMPTY_CHAR_ARRAY = {}; |
| 96 | |
| 97 | /** |
| 98 | * An empty immutable {@link Character} array. |
| 99 | */ |
| 100 | public static final Character[] EMPTY_CHARACTER_OBJECT_ARRAY = {}; |
| 101 | |
| 102 | /** |
| 103 | * An empty immutable {@link Class} array. |
| 104 | */ |
| 105 | public static final Class<?>[] EMPTY_CLASS_ARRAY = {}; |
| 106 | |
| 107 | /** |
| 108 | * An empty immutable {@code double} array. |
| 109 | */ |
| 110 | public static final double[] EMPTY_DOUBLE_ARRAY = {}; |
| 111 | |
| 112 | /** |
| 113 | * An empty immutable {@link Double} array. |
| 114 | */ |
| 115 | public static final Double[] EMPTY_DOUBLE_OBJECT_ARRAY = {}; |
| 116 | |
| 117 | /** |
| 118 | * An empty immutable {@link Field} array. |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…