public class ArrayUtils
extends java.lang.Object
isEmpty(Object[])
is null or its length is 0getLast(Object[], Object, Object, boolean)
get last element of the target element, before the first one
that match the target element front to backgetNext(Object[], Object, Object, boolean)
get next element of the target element, after the first one
that match the target element front to backgetLast(Object[], Object, boolean)
getLast(int[], int, int, boolean)
getLast(long[], long, long, boolean)
getNext(Object[], Object, boolean)
getNext(int[], int, int, boolean)
getNext(long[], long, long, boolean)
Constructor and Description |
---|
ArrayUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
getLast(int[] sourceArray,
int value,
int defaultValue,
boolean isCircle) |
static long |
getLast(long[] sourceArray,
long value,
long defaultValue,
boolean isCircle) |
static <V> V |
getLast(V[] sourceArray,
V value,
boolean isCircle) |
static <V> V |
getLast(V[] sourceArray,
V value,
V defaultValue,
boolean isCircle)
get last element of the target element, before the first one that match the target element front to back
if array is empty, return defaultValue
if target element is not exist in array, return defaultValue
if target element exist in array and its index is not 0, return the last element
if target element exist in array and its index is 0, return the last one in array if isCircle is true, else
return defaultValue
|
static int |
getNext(int[] sourceArray,
int value,
int defaultValue,
boolean isCircle) |
static long |
getNext(long[] sourceArray,
long value,
long defaultValue,
boolean isCircle) |
static <V> V |
getNext(V[] sourceArray,
V value,
boolean isCircle) |
static <V> V |
getNext(V[] sourceArray,
V value,
V defaultValue,
boolean isCircle)
get next element of the target element, after the first one that match the target element front to back
if array is empty, return defaultValue
if target element is not exist in array, return defaultValue
if target element exist in array and not the last one in array, return the next element
if target element exist in array and the last one in array, return the first one in array if isCircle is
true, else return defaultValue
|
static <V> boolean |
isEmpty(V[] sourceArray)
is null or its length is 0
|
public static <V> boolean isEmpty(V[] sourceArray)
V
- sourceArray
- public static <V> V getLast(V[] sourceArray, V value, V defaultValue, boolean isCircle)
V
- sourceArray
- value
- value of target elementdefaultValue
- default return valueisCircle
- whether is circlepublic static <V> V getNext(V[] sourceArray, V value, V defaultValue, boolean isCircle)
V
- sourceArray
- value
- value of target elementdefaultValue
- default return valueisCircle
- whether is circlepublic static <V> V getLast(V[] sourceArray, V value, boolean isCircle)
ArrayUtils#getLast(Object[], Object, Object, boolean)} defaultValue is null
public static <V> V getNext(V[] sourceArray, V value, boolean isCircle)
ArrayUtils#getNext(Object[], Object, Object, boolean)} defaultValue is null
public static long getLast(long[] sourceArray, long value, long defaultValue, boolean isCircle)
ArrayUtils#getLast(Object[], Object, Object, boolean)} Object is Long
public static long getNext(long[] sourceArray, long value, long defaultValue, boolean isCircle)
ArrayUtils#getNext(Object[], Object, Object, boolean)} Object is Long
public static int getLast(int[] sourceArray, int value, int defaultValue, boolean isCircle)
ArrayUtils#getLast(Object[], Object, Object, boolean)} Object is Integer
public static int getNext(int[] sourceArray, int value, int defaultValue, boolean isCircle)
ArrayUtils#getNext(Object[], Object, Object, boolean)} Object is Integer