public interface SparseNumericArray<T extends Number> extends SparseArray<T>
In addition, it is suggested that instances that wrap Java primitive-type arrays provide additional methods that operate directly on the primitive types rather than their object equivalents. This allows users to save any performance costs from auto-boxing the primitives.
Modifier and Type | Method and Description |
---|---|
T |
add(int index,
T delta)
Adds the specified value to the value at the index and stores the result
(just as
array[index] += delta ). |
T |
divide(int index,
T value)
Divides the specified value to the index by the provided value and stores
the result at the index (just as
array[index] /= value ) |
T |
multiply(int index,
T value)
Multiplies the value to the index by the provided value and saves the
result at the index (just as
array[index] *= value ) |
cardinality, get, getElementIndices, length, set, toArray
T add(int index, T delta)
array[index] += delta
). Note that this can be used with
negative delta
values to achieve equivalent -=
functionality.index
- the position in the arraydelta
- the change in value at the indexT multiply(int index, T value)
array[index] *= value
)index
- the position in the arraydelta
- the change in value at the indexCopyright © 2012. All Rights Reserved.