The (fixed) length of the array
The default value used for elements without a specifically set value.
The proportion of elements with non-default values beyond which the array will be materialized
Getter for the element at the given index
The default value of the sparse array
The density - or the proportion of elements with non-default values - of this SparseArray
Shorthand accessor for the first element of the array
Shorthand accessor for the first element of the array
The head element
The range of indices of the sparse array
The (fixed) length of the sparse array
Transform this SparseArray according to the input function
Transform this SparseArray according to the input function
Note that side-effects (such as a side total) are not guaranteed correct in SparseArrays - the transformation function will not be run on defaulted entries.
The output value type
The value transformation function
A new SparseArray, with the values of this array transformed as specified
Transform this SparseArray according to the input function.
Transform this SparseArray according to the input function.
Unlike map, the input function here is given the index of the element.
For the default value, it is given an index of -1.
The output value type
The value transformation function
A new SparseArray, with the values of this array transformed as specified
Transform this SparseArray into a normal scala Seq.
Transform this SparseArray into a normal scala Seq. This returns a materialized form of the SparseArray, but does not materialize the SparseArray itself.
Setter for the element at the given index
An integer-indexed sparse array implementation, currently based on HashMap.
Specialized for storing Ints, Longs and Doubles
Automatically materializes into a dense array when the number of non-default values stored exceeds some threshold.
Note that this is not a standard scala sequence. Use the .seq method to obtain an equivalent that is, if needed.
Probably not thread-safe due to lack of locking on materialization.
TODO: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/ReadWriteLock.html
the type of value being stored in the SparseArray