Arrays

object Arrays

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.

Since:

3.0.0

class Object
trait Matchable
class Any
Arrays.type

Value members

Concrete methods

def concat[T : ClassTag](arrays: Array[T]*): Array[T]
def isBlank(array: Array[_]): Boolean
def isEmpty(array: Array[_]): Boolean

Checks if an array of Objects is empty or null.

Checks if an array of Objects is empty or null.

Value parameters:
array

the array to test

Returns:

true if the array is empty or null

def subarray[T : ClassTag](array: Array[T], startIndexInclusive: Int, endIndexExclusive: Int): Array[T]

Produces a new array containing the elements between the start and end indices.

Produces a new array containing the elements between the start and end indices.

The start index is inclusive, the end index exclusive. Null array input produces null output.

The component type of the subarray is always the same as that of the input array. Thus, if the input is an array of type Date, the following usage is envisaged:

Date[] someDates = (Date[]) Arrays.subarray(allDates, 2, 5);
Value parameters:
<T>

the component type of the array

array

the array

endIndexExclusive

elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.

startIndexInclusive

the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.

Returns:

a new array containing the elements between the start and end indices.

def toString(a: Any*): String