You can process data in arrays and collections using the following library.
When using a collection format, some of the following methods which perform
operations between two arrays or collections determine data type automatically
based on Java defaults. For example, 3
is treated as integer,
3.5
as a double and c
as a string.
However, array comparison is based on the array data types.
#data.containsAll(new int[] {2,4,6,8,10}, new int[] {2,8})
returns as true because both are int arrays.
#data.containsAll(new int[] {2,4,6,8,10}, {2,8})
returns as true
because the first argument is an int array and the second argument uses int by
default.
#data.containsAll(new float[] {2.1,4.1,6.1,8.1,10.1}, {2.1,8.1})
returns as false because the first argument is a float array and the second
argument is a double, which is the default for floating point numbers.
#data.containsAll(new double[] {2.1,4.1,6.1,8.1,10.1},
{2.1,8.1})
returns as true because the first argument is a double
array and the second argument is treated as a double by default.
#data.containsAll({2.1,4.1,6.1,8.1,10.1}, {2.1,8.1})
returns as
true because both arguments are collections and use the default data types.
String | Description | Input | Output |
---|---|---|---|
int indexOf(Array <srcArray>,
<valueToFind>) where:
|
Finds and returns the index of the
|
|
|
boolean isNotEmpty(Array <srcArray>) where
|
Checks if the input array is not empty and not null. |
|
|
boolean containsAll(Array <srcData>, Array
<searchData>) where
|
Returns true if all elements of
|
|
|
boolean containsAny(Array <srcData>, Array
<searchData>) where
|
Returns true if there is at least one common element in both arrays. |
|
|
Array removeAll(Array <srcData>, Array
<dataToRemove>) where
|
Removes the elements in
|
|
|
Array retainAll(Array <srcData>, Array
<dataToRetain>) where:
|
Retains only the elements that exist in both
|
|
|
Array union(Array <array1>, Array
<array2>) where:
|
Returns a new array containing the second array appended to the first array. |
|
|
int size(Array <inputArray>) where
|
Returns the size of the input array. |
|
|
boolean equals(Array <array1>, Array
<array2>) where
|
Tests two arrays for value-equality and returns true if both arrays have the same size and all corresponding pairs of elements in the two arrays are equal. |
|
|