Novah Documentation

novah.array

Functions to work with native Java arrays.

Types

Declarations


size

visibility: public
type: Array a -> Int32

Returns the size of this array. Runtime: O(1)


stream

visibility: public
type: Array a -> Stream a

Returns a stream for this array.


fromStream

visibility: public
type: Stream a -> Array Object

Collects this stream into an array.


nth

visibility: public
type: Int32 -> Array a -> Option a

Returns some value at index for this array if it exists or none. This is a safe version of aget. Runtime: O(1)


isEmpty

visibility: public
type: Array a -> Boolean

Returns true if the array is empty. Runtime: O(1)


isNotEmpty

visibility: public
type: Array a -> Boolean

Returns true if the array is not empty. Runtime: O(1)


find

visibility: public
type: (a -> Boolean) -> Array a -> Option a

Returns the first occurrence of elem in the array for which the predicate returns true. Runtime: O(n)


containedArray

visibility: public
type: {{ Equals a }} -> Contained a (Array a)

forEach

visibility: public
type: Array a -> (a -> Unit) -> Unit

Runs function f for every element of this array, ignoring the result. Runtime: O(n)


forEachIndexed

visibility: public
type: Array a -> (Int32 -> a -> Unit) -> Unit

Runs function f for every index and element of this array, ignoring the result. Runtime: O(n)


map

visibility: public
type: (a -> b) -> Array a -> Array Object

Maps function f over all elements of this array returning an array of the same size. Runtime: O(n)


filter

visibility: public
type: (a -> Boolean) -> Array a -> Array Object

Returns an array of the elements that match the given predicate. Runtime: O(n)


sortBy

visibility: public
type: (a -> a -> Ordering) -> Array a -> Unit

Sorts this array in place according to the comparing function.


sort

visibility: public
type: {{ Ord a }} -> Array a -> Unit

Sorts this array in place according to the elements Ord instance.


reverse

visibility: public
type: Array a -> Array a

Returns a new array with the same elements in the reverse order of the input array. Runtime: O(n)


reversed

visibility: public
type: Array a -> Unit

Reverses this array in place. Runtime: O(n/2)


byteArray

visibility: public
type: Int32 -> ByteArray

Creates a byte array of the specified size.


int16Array

visibility: public
type: Int32 -> Int16Array

Creates a int16 array of the specified size.


int32Array

visibility: public
type: Int32 -> Int32Array

Creates a int32 array of the specified size.


int64Array

visibility: public
type: Int32 -> Int64Array

Creates a int64 array of the specified size.


float32Array

visibility: public
type: Int32 -> Float32Array

Creates a float32 array of the specified size.


float64Array

visibility: public
type: Int32 -> Float64Array

Creates a float64 array of the specified size.


charArray

visibility: public
type: Int32 -> CharArray

Creates a char array of the specified size.


booleanArray

visibility: public
type: Int32 -> BooleanArray

Creates a boolean array of the specified size.


copy

visibility: public
type: Array a -> Array a

Returns a copy of this array.


emptyCopy

visibility: public
type: Array a -> Array a

Returns a new array of the same size and type as the supplied array.


byteaset

visibility: public
type: Int32 -> Byte -> ByteArray -> Unit

Sets the element of this byte array at the specified index. Unsafe: Will thrown a java.lang.IndexOutOfBoundsException if the index doesn't exist. Runtime: O(1)


int16aset

visibility: public
type: Int32 -> Int16 -> Int16Array -> Unit

Sets the element of this int16 array at the specified index. Unsafe: Will thrown a java.lang.IndexOutOfBoundsException if the index doesn't exist. Runtime: O(1)


int32aset

visibility: public
type: Int32 -> Int32 -> Int32Array -> Unit

Sets the element of this int array at the specified index. Unsafe: Will thrown a java.lang.IndexOutOfBoundsException if the index doesn't exist. Runtime: O(1)


int64aset

visibility: public
type: Int32 -> Int64 -> Int64Array -> Unit

Sets the element of this int64 array at the specified index. Unsafe: Will thrown a java.lang.IndexOutOfBoundsException if the index doesn't exist. Runtime: O(1)


float32aset

visibility: public
type: Int32 -> Float32 -> Float32Array -> Unit

Sets the element of this float32 array at the specified index. Unsafe: Will thrown a java.lang.IndexOutOfBoundsException if the index doesn't exist. Runtime: O(1)


float64aset

visibility: public
type: Int32 -> Float64 -> Float64Array -> Unit

Sets the element of this float64 array at the specified index. Unsafe: Will thrown a java.lang.IndexOutOfBoundsException if the index doesn't exist. Runtime: O(1)


booleanaset

visibility: public
type: Int32 -> Boolean -> BooleanArray -> Unit

Sets the element of this boolean array at the specified index. Unsafe: Will thrown a java.lang.IndexOutOfBoundsException if the index doesn't exist. Runtime: O(1)


charaset

visibility: public
type: Int32 -> Char -> CharArray -> Unit

Sets the element of this char array at the specified index. Unsafe: Will thrown a java.lang.IndexOutOfBoundsException if the index doesn't exist. Runtime: O(1)


containedByteArray

visibility: public
type: Contained Byte ByteArray

containedInt16Array

visibility: public
type: Contained Int16 Int16Array

containedInt32Array

visibility: public
type: Contained Int32 Int32Array

containedInt64Array

visibility: public
type: Contained Int64 Int64Array

containedFloat32Array

visibility: public
type: Contained Float32 Float32Array

containedFloat64Array

visibility: public
type: Contained Float64 Float64Array

containedBoolean

visibility: public
type: Contained Boolean BooleanArray

containedChar

visibility: public
type: Contained Char CharArray