public interface ScalarArray
extends java.io.Serializable
This interface lets you implement your own data structure behind a scalar array.
To instantiate a custom scalar array:
Scalar temp = SleepUtils.getArrayScalar(new MyScalarArray());
When implementing the following interface, keep in mind you are implementing an interface to an array data structure.
Modifier and Type | Method and Description |
---|---|
Scalar |
add(Scalar value,
int index)
add an element to the array at the specified index
|
Scalar |
getAt(int index)
get an element at the specified index
|
Scalar |
pop()
remove the topmost element from the array
|
Scalar |
push(Scalar value)
add an element onto the end of the array
|
Scalar |
remove(int index)
remove an element at the specified index
|
void |
remove(Scalar value)
remove all elements with the same identity as the specified scalar
|
java.util.Iterator |
scalarIterator()
return an iterator
|
int |
size()
return the size of the array
|
void |
sort(java.util.Comparator compare)
sort this array with the specified comparator
|
ScalarArray |
sublist(int start,
int end)
return a view into the array, ideally one that uses the same backing store
|
Scalar pop()
int size()
Scalar getAt(int index)
java.util.Iterator scalarIterator()
void remove(Scalar value)
Scalar remove(int index)
void sort(java.util.Comparator compare)
ScalarArray sublist(int start, int end)