Modifier and Type | Class and Description |
---|---|
static interface |
ArrayUtil.ArrayEquality |
Modifier and Type | Field and Description |
---|---|
static ArrayUtil.ArrayEquality |
BOXING_AWARE_ARRAY_EQUALITY |
static ArrayUtil.ArrayEquality |
DEFAULT_ARRAY_EQUALITY |
Modifier and Type | Method and Description |
---|---|
static boolean |
approximatelyEqual(double[] that,
double[] other,
double tolerance) |
static <T> T[] |
array(T... varargs)
Returns the array version of the vararg argument.
|
static Object |
clone(Object array) |
static <T> T[] |
concat(T[] initial,
T... additional)
Create a array from a existing array and additional items following it.
|
static <T> T[] |
concat(T first,
T... additional)
Create an array from a single first item and additional items following it.
|
static <T> boolean |
contains(T[] array,
int arrayLength,
T contains)
Check if array contains item.
|
static <T> boolean |
contains(T[] array,
T contains)
Check if array contains item.
|
static <T> boolean |
containsAll(T[] array,
T[] contains)
Count items from a different array contained in an array.
|
static boolean |
equals(Object firstArray,
Object otherArray) |
static boolean |
equals(Object firstArray,
Object otherArray,
ArrayUtil.ArrayEquality equality)
Check if two arrays are equal.
|
static int |
hashCode(Object array) |
static <T> int |
indexOf(T[] array,
T item) |
static boolean |
isEmpty(Object[] array)
Check if provided array is empty
|
static <T> String |
join(T[] items,
String delimiter)
Convert an array to a String using a custom delimiter.
|
static <FROM,TO> TO[] |
map(FROM[] from,
Function<FROM,TO> transformer,
Class<TO> toClass)
Create new array with all items converted into a new type using a supplied transformer.
|
static <T> int |
missing(T[] array,
T[] contains)
Count missing items in an array.
|
static <T> boolean |
nullSafeEquals(T first,
T other)
Compare two items for equality; if both are
null they are regarded as equal. |
static <T> T[] |
union(T[] first,
T[] other)
Get the union of two arrays.
|
static <T> T[] |
without(T[] source,
T... toRemove) |
public static final ArrayUtil.ArrayEquality DEFAULT_ARRAY_EQUALITY
public static final ArrayUtil.ArrayEquality BOXING_AWARE_ARRAY_EQUALITY
public static int hashCode(Object array)
public static boolean equals(Object firstArray, Object otherArray, ArrayUtil.ArrayEquality equality)
Arrays
.
Both arguments must be arrays of some type.firstArray
- value to compare to the other valueotherArray
- value to compare to the first valueequality
- equality logictrue
if the arrays are equalfor similar functionality.
public static boolean approximatelyEqual(double[] that, double[] other, double tolerance)
public static <T> int missing(T[] array, T[] contains)
T
- The type of the array itemsarray
- Array to examinecontains
- Items to look forcontains
are missing from array
.public static <T> boolean containsAll(T[] array, T[] contains)
T
- The type of the array itemsarray
- Array to examinecontains
- Items to look fortrue
if all items in contains
exists in array
, otherwise false
.public static <T> boolean contains(T[] array, T contains)
T
- The type of the array itemsarray
- Array to examinecontains
- Single item to look fortrue
if contains
exists in array
, otherwise false
.public static <T> boolean contains(T[] array, int arrayLength, T contains)
T
- The type of the array itemsarray
- Array to examinearrayLength
- Number of items to check, from the start of the arraycontains
- Single item to look fortrue
if contains
exists in array
, otherwise false
.public static <T> boolean nullSafeEquals(T first, T other)
null
they are regarded as equal.T
- The type of the itemsfirst
- First item to compareother
- Other item to comparetrue
if first
and other
are both null
or are both equal.public static <T> T[] union(T[] first, T[] other)
T
- The type of the arraysfirst
- First arrayother
- Other arrayfirst
and other
. Items occurring in
both first
and other
will only have of the two in the resulting union.public static boolean isEmpty(Object[] array)
array
- - array to checkpublic static <T> String join(T[] items, String delimiter)
T
- The type of the arrayitems
- The array to convertdelimiter
- The delimiter to useString
representation of items
with a custom delimiter in between.public static <FROM,TO> TO[] map(FROM[] from, Function<FROM,TO> transformer, Class<TO> toClass)
FROM
- type of original itemsTO
- type of the converted itemsfrom
- original arraytransformer
- transformer that converts an item from the original to the target typetoClass
- target type for itemsfrom
converted into type toClass
.public static <T> T[] concat(T first, T... additional)
T
- the type of the itemsfirst
- the item to put firstadditional
- the additional items to add to the arrayfirst
as the item at index 0
and the additional
items following it.public static <T> T[] concat(T[] initial, T... additional)
T
- the type of the array itemsinitial
- the initial arrayadditional
- the additional items that would be added into the initial array@SafeVarargs public static <T> T[] array(T... varargs)
T
- the type of the itemsvarargs
- the itemspublic static <T> int indexOf(T[] array, T item)
public static <T> T[] without(T[] source, T... toRemove)
Copyright © 2002–2016 The Neo4j Graph Database Project. All rights reserved.