T
- the type of elements in this listpublic interface ListIndex<T>
extends java.lang.Iterable<T>
The "destructive" methods of the list, i.e., those that change its contents,
are specified to throw UnsupportedOperationException
if
this list has been created with a read-only database view.
When the corresponding view goes out of scope, this list is destroyed. Subsequent use
of the closed list is prohibited and will result in IllegalStateException
.
This interface prohibits null elements. All method arguments are non-null by default.
Modifier and Type | Method and Description |
---|---|
void |
add(T e)
Adds a new element to the end of the list.
|
void |
addAll(java.util.Collection<? extends T> elements)
Adds all elements from the specified collection to this list.
|
void |
clear()
Clears the list.
|
T |
get(long index)
Returns the element at the given index.
|
T |
getLast()
Returns the last element of the list.
|
java.lang.String |
getName()
Returns the name of this index.
|
boolean |
isEmpty()
Returns true if the list is empty, false — otherwise.
|
java.util.Iterator<T> |
iterator()
Returns an iterator over the elements of the list.
|
void |
set(long index,
T e)
Replaces the element at the given index of the list with the specified element.
|
long |
size()
Returns the number of elements in the list.
|
void add(T e)
e
- an element to append to the listjava.lang.IllegalStateException
- if this list is not validjava.lang.UnsupportedOperationException
- if this list is read-onlyvoid addAll(java.util.Collection<? extends T> elements)
If the collection contains an invalid element, this list is not modified.
elements
- elements to add to this listjava.lang.NullPointerException
- if the collection is null or it contains null elements.
In this case the collection is not modified.java.lang.IllegalStateException
- if this list is not validjava.lang.UnsupportedOperationException
- if this list is read-onlyvoid set(long index, T e)
index
- an index of the element to replacee
- an element to addjava.lang.IndexOutOfBoundsException
- if the index is invalidjava.lang.IllegalStateException
- if this list is not validjava.lang.UnsupportedOperationException
- if this list is read-onlyT get(long index)
index
- an index of the element to returnjava.lang.IndexOutOfBoundsException
- if index is invalidjava.lang.IllegalStateException
- if this list is not validT getLast()
java.util.NoSuchElementException
- if the list is emptyjava.lang.IllegalStateException
- if this list is not validvoid clear()
java.lang.IllegalStateException
- if this list is not validjava.lang.UnsupportedOperationException
- if this list is read-onlyboolean isEmpty()
java.lang.IllegalStateException
- if this list is not validlong size()
java.lang.IllegalStateException
- if this list is not validjava.util.Iterator<T> iterator()
Any destructive operation on the same Fork
this list uses
(but not necessarily on this list) will invalidate the iterator.
iterator
in interface java.lang.Iterable<T>
java.lang.IllegalStateException
- if this list is not validjava.lang.String getName()
Copyright © 2018 Exonum. All rights reserved.