[LANG-1569] Add ArrayUtils.get(T[], index, T) to provide an
out-of-bounds default value
This commit is contained in:
parent
5b699d0765
commit
b2412284a3
|
@ -1678,7 +1678,7 @@ public class ArrayUtils {
|
||||||
* @return the nTh element of an array or a default value if the index is out of bounds.
|
* @return the nTh element of an array or a default value if the index is out of bounds.
|
||||||
* @since 3.11
|
* @since 3.11
|
||||||
*/
|
*/
|
||||||
public static <T> T get(final T[] array, final int index, T defaultValue) {
|
public static <T> T get(final T[] array, final int index, final T defaultValue) {
|
||||||
if (array == null) {
|
if (array == null) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue