public class StoredList<E> extends StoredCollection<E> implements java.util.List<E>
Database.
For all stored lists the keys of the underlying Database must have record number format, and therefore the store or index must be a RECNO, RECNO-RENUMBER, QUEUE, or BTREE-RECNUM database. Only RECNO-RENUMBER allows true list behavior where record numbers are renumbered following the position of an element that is added or removed. For the other access methods (RECNO, QUEUE, and BTREE-RECNUM), stored Lists are most useful as read-only collections where record numbers are not required to be sequential.
In addition to the standard List methods, this class provides the following methods for stored lists only. Note that the use of these methods is not compatible with the standard Java collections interface.
DEFAULT_ITERATOR_BLOCK_SIZE| Constructor and Description |
|---|
StoredList(Database database,
EntityBinding<E> valueEntityBinding,
boolean writeAllowed)
Creates a list entity view of a
Database. |
StoredList(Database database,
EntityBinding<E> valueEntityBinding,
PrimaryKeyAssigner keyAssigner)
Creates a list entity view of a
Database with a PrimaryKeyAssigner. |
StoredList(Database database,
EntryBinding<E> valueBinding,
boolean writeAllowed)
Creates a list view of a
Database. |
StoredList(Database database,
EntryBinding<E> valueBinding,
PrimaryKeyAssigner keyAssigner)
Creates a list view of a
Database with a PrimaryKeyAssigner. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E value)
Appends the specified element to the end of this list (optional
operation).
|
void |
add(int index,
E value)
Inserts the specified element at the specified position in this list
(optional operation).
|
boolean |
addAll(int index,
java.util.Collection<? extends E> coll)
Inserts all of the elements in the specified collection into this list
at the specified position (optional operation).
|
int |
append(E value)
Appends a given value returning the newly assigned index.
|
boolean |
contains(java.lang.Object value)
Returns true if this list contains the specified element.
|
boolean |
equals(java.lang.Object other)
Compares the specified object with this list for equality.
|
E |
get(int index)
Returns the element at the specified position in this list.
|
int |
hashCode() |
int |
indexOf(java.lang.Object value)
Returns the index in this list of the first occurrence of the specified
element, or -1 if this list does not contain this element.
|
int |
lastIndexOf(java.lang.Object value)
Returns the index in this list of the last occurrence of the specified
element, or -1 if this list does not contain this element.
|
java.util.ListIterator<E> |
listIterator()
Returns a list iterator of the elements in this list (in proper
sequence).
|
java.util.ListIterator<E> |
listIterator(int index)
Returns a list iterator of the elements in this list (in proper
sequence), starting at the specified position in this list.
|
E |
remove(int index)
Removes the element at the specified position in this list (optional
operation).
|
boolean |
remove(java.lang.Object value)
Removes the first occurrence in this list of the specified element
(optional operation).
|
E |
set(int index,
E value)
Replaces the element at the specified position in this list with the
specified element (optional operation).
|
java.util.List<E> |
subList(int fromIndex,
int toIndex)
Returns a view of the portion of this list between the specified
fromIndex, inclusive, and toIndex, exclusive.
|
addAll, containsAll, getIteratorBlockSize, iterator, iterator, join, removeAll, retainAll, setIteratorBlockSize, size, storedIterator, storedIterator, toArray, toArray, toList, toStringareDuplicatesAllowed, areDuplicatesOrdered, areKeyRangesAllowed, areKeysRenumbered, clear, getCursorConfig, isEmpty, isOrdered, isSecondary, isTransactional, isWriteAllowedpublic StoredList(Database database, EntryBinding<E> valueBinding, boolean writeAllowed)
Database.database - is the Database underlying the new collection.valueBinding - is the binding used to translate between value
buffers and value objects.writeAllowed - is true to create a read-write collection or false
to create a read-only collection.java.lang.IllegalArgumentException - if formats are not consistently
defined or a parameter is invalid.RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public StoredList(Database database, EntityBinding<E> valueEntityBinding, boolean writeAllowed)
Database.database - is the Database underlying the new collection.valueEntityBinding - is the binding used to translate between
key/value buffers and entity value objects.writeAllowed - is true to create a read-write collection or false
to create a read-only collection.java.lang.IllegalArgumentException - if formats are not consistently
defined or a parameter is invalid.RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public StoredList(Database database, EntryBinding<E> valueBinding, PrimaryKeyAssigner keyAssigner)
Database with a PrimaryKeyAssigner. Writing is allowed for the created list.database - is the Database underlying the new collection.valueBinding - is the binding used to translate between value
buffers and value objects.keyAssigner - is used by the add(int, E) and append(E)
methods to assign primary keys.java.lang.IllegalArgumentException - if formats are not consistently
defined or a parameter is invalid.RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public StoredList(Database database, EntityBinding<E> valueEntityBinding, PrimaryKeyAssigner keyAssigner)
Database with a PrimaryKeyAssigner. Writing is allowed for the created list.database - is the Database underlying the new collection.valueEntityBinding - is the binding used to translate between
key/value buffers and entity value objects.keyAssigner - is used by the add(int, E) and append(E)
methods to assign primary keys.java.lang.IllegalArgumentException - if formats are not consistently
defined or a parameter is invalid.RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public void add(int index,
E value)
List.add(int, Object) interface.add in interface java.util.List<E>java.lang.UnsupportedOperationException - if the collection is a sublist, or
if the collection is indexed, or if the collection is read-only, or if
the RECNO-RENUMBER access method was not used.RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public boolean add(E value)
List.add(Object) interface.add in interface java.util.Collection<E>add in interface java.util.List<E>java.lang.UnsupportedOperationException - if the collection is a sublist, or
if the collection is indexed, or if the collection is read-only, or if
the RECNO-RENUMBER access method was not used.RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public int append(E value)
PrimaryKeyAssigner is associated
with Store for this list, it will be used to assigned the returned
index. Otherwise the Store must be a QUEUE or RECNO database and the
next available record number is assigned as the index. This method does
not exist in the standard List interface.value - the value to be appended.java.lang.UnsupportedOperationException - if the collection is indexed, or
if the collection is read-only, or if the Store has no PrimaryKeyAssigner and is not a QUEUE or
RECNO database.RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public boolean addAll(int index,
java.util.Collection<? extends E> coll)
List.addAll(int, Collection)
interface.addAll in interface java.util.List<E>java.lang.UnsupportedOperationException - if the collection is a sublist, or
if the collection is indexed, or if the collection is read-only, or if
the RECNO-RENUMBER access method was not used.RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public boolean contains(java.lang.Object value)
List.contains(java.lang.Object) interface.contains in interface java.util.Collection<E>contains in interface java.util.List<E>RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public E get(int index)
List.get(int) interface.get in interface java.util.List<E>RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public int indexOf(java.lang.Object value)
List.indexOf(java.lang.Object) interface.indexOf in interface java.util.List<E>RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public int lastIndexOf(java.lang.Object value)
List.lastIndexOf(java.lang.Object) interface.lastIndexOf in interface java.util.List<E>RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public java.util.ListIterator<E> listIterator()
List.listIterator() interface.
For information on cursor stability and iterator block size, see
StoredCollection.iterator().
listIterator in interface java.util.List<E>ListIterator for this collection.RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).StoredContainer.isWriteAllowed()public java.util.ListIterator<E> listIterator(int index)
List.listIterator(int) interface.
For information on cursor stability and iterator block size, see
StoredCollection.iterator().
listIterator in interface java.util.List<E>ListIterator for this collection.RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).StoredContainer.isWriteAllowed()public E remove(int index)
List.remove(int) interface.remove in interface java.util.List<E>java.lang.UnsupportedOperationException - if the collection is a sublist, or
if the collection is read-only.RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public boolean remove(java.lang.Object value)
List.remove(Object) interface.remove in interface java.util.Collection<E>remove in interface java.util.List<E>java.lang.UnsupportedOperationException - if the collection is a sublist, or
if the collection is read-only.RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public E set(int index, E value)
List.set(int, E) interface.set in interface java.util.List<E>java.lang.UnsupportedOperationException - if the collection is indexed, or
if the collection is read-only.java.lang.IllegalArgumentException - if an entity value binding is used and
the primary key of the value given is different than the existing stored
primary key.RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public java.util.List<E> subList(int fromIndex, int toIndex)
List.subList(int, int) interface.subList in interface java.util.List<E>RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public boolean equals(java.lang.Object other)
List.equals(java.lang.Object) interface.equals in interface java.util.Collection<E>equals in interface java.util.List<E>equals in class StoredCollection<E>RuntimeExceptionWrapper - if a checked exception is thrown,
including a DatabaseException on BDB (C Edition).public int hashCode()
hashCode in interface java.util.Collection<E>hashCode in interface java.util.List<E>hashCode in class StoredCollection<E>Copyright (c) 1996, 2015 Oracle and/or its affiliates. All rights reserved.