Package score
Interface ArrayDB<E>
-
- Type Parameters:
E
- Element type. It shall be readable and writable class.
public interface ArrayDB<E>
An array DB holds a sequence of values.- See Also:
ObjectReader
,ObjectWriter
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(E value)
Adds a value at the end of the array DB.E
get(int index)
Returns the element at the specified position in the array DB.E
pop()
Pops last element of the array DB.void
removeLast()
Removes last element of the array DB.void
set(int index, E value)
Sets value of the specified index.int
size()
Returns number of elements in this array DB.
-
-
-
Method Detail
-
add
void add(E value)
Adds a value at the end of the array DB.- Parameters:
value
- new value
-
set
void set(int index, E value)
Sets value of the specified index.- Parameters:
index
- indexvalue
- new value- Throws:
java.lang.IllegalArgumentException
- if index is out of range.
-
removeLast
void removeLast()
Removes last element of the array DB.- Throws:
java.lang.IllegalStateException
- if array DB has zero elements.
-
get
E get(int index)
Returns the element at the specified position in the array DB.- Parameters:
index
- index of element- Returns:
- the element at the specified position in the array DB.
- Throws:
java.lang.IllegalArgumentException
- if index is out of range.
-
size
int size()
Returns number of elements in this array DB.- Returns:
- number of elements in this array DB.
-
pop
E pop()
Pops last element of the array DB.- Returns:
- last element of array DB
- Throws:
java.lang.IllegalStateException
- if array DB has zero elements.
-
-