com.sleepycat.collections
public abstract class StoredCollection extends StoredContainer implements Collection
In addition, this class provides the following methods for stored collections only. Note that the use of these methods is not compatible with the standard Java collections interface.
Field Summary | |
---|---|
static int | DEFAULT_ITERATOR_BLOCK_SIZE
The default number of records read at one time by iterators. |
Method Summary | |
---|---|
boolean | addAll(Collection coll)
Adds all of the elements in the specified collection to this collection
(optional operation).
|
boolean | containsAll(Collection coll)
Returns true if this collection contains all of the elements in the
specified collection.
|
boolean | equals(Object other)
Compares the specified object with this collection for equality.
|
int | getIteratorBlockSize()
Returns the number of records read at one time by iterators returned by
the StoredCollection method. |
int | hashCode() |
Iterator | iterator()
Returns an iterator over the elements in this collection.
|
StoredIterator | iterator(boolean writeAllowed) |
StoredIterator | join(StoredContainer[] indices, Object[] indexKeys, JoinConfig joinConfig)
Returns an iterator representing an equality join of the indices and
index key values specified.
|
boolean | removeAll(Collection coll)
Removes all this collection's elements that are also contained in the
specified collection (optional operation).
|
boolean | retainAll(Collection coll)
Retains only the elements in this collection that are contained in the
specified collection (optional operation).
|
void | setIteratorBlockSize(int blockSize)
Changes the number of records read at one time by iterators returned by
the StoredCollection method. |
int | size() |
StoredIterator | storedIterator()
Returns an iterator over the elements in this collection.
|
StoredIterator | storedIterator(boolean writeAllowed)
Returns a read or read-write iterator over the elements in this
collection.
|
Object[] | toArray()
Returns an array of all the elements in this collection.
|
Object[] | toArray(Object[] a)
Returns an array of all the elements in this collection whose runtime
type is that of the specified array.
|
List | toList()
Returns a copy of this collection as an ArrayList. |
String | toString()
Converts the collection to a string representation for debugging.
|
See Also: StoredCollection
Throws: UnsupportedOperationException if the collection is read-only, or if the collection is indexed, or if the add method is not supported by the concrete collection. RuntimeExceptionWrapper if a DatabaseException is thrown.
Throws: RuntimeExceptionWrapper if a DatabaseException is thrown.
Throws: RuntimeExceptionWrapper if a DatabaseException is thrown.
The iterator returned by this method does not keep a database cursor open and therefore it does not need to be closed. It reads blocks of records as needed, opening and closing a cursor to read each block of records. The number of records per block is 10 by default and can be changed with StoredCollection.
Because this iterator does not keep a cursor open, if it is used without transactions, the iterator does not have cursor stability characteristics. In other words, the record at the current iterator position can be changed or deleted by another thread. To prevent this from happening, call this method within a transaction or use the storedIterator method instead.
Returns: a standard Iterator for this collection.
See Also: StoredCollection
Deprecated: Please use storedIterator or StoredCollection instead. Because the iterator returned must be closed, the method name {@code iterator} is confusing since standard Java iterators do not need to be closed.
Warning: The iterator returned must be explicitly closed using close or close to release the underlying database cursor resources.
The returned iterator supports only the two methods: hasNext() and next(). All other methods will throw UnsupportedOperationException.
Parameters: indices is an array of indices with elements corresponding to those in the indexKeys array. indexKeys is an array of index key values identifying the elements to be selected. joinConfig is the join configuration, or null to use the default configuration.
Returns: an iterator over the elements in this collection that match all specified index key values.
Throws: IllegalArgumentException if this collection is indexed or if a given index does not have the same store as this collection. RuntimeExceptionWrapper if a DatabaseException is thrown.
Throws: UnsupportedOperationException if the collection is read-only. RuntimeExceptionWrapper if a DatabaseException is thrown.
Throws: UnsupportedOperationException if the collection is read-only. RuntimeExceptionWrapper if a DatabaseException is thrown.
Throws: IllegalArgumentException if the blockSize is less than two.
Warning: The iterator returned must be explicitly closed using close or close to release the underlying database cursor resources.
Returns: a StoredIterator for this collection.
See Also: StoredCollection
Warning: The iterator returned must be explicitly closed using close or close to release the underlying database cursor resources.
Parameters: writeAllowed is true to open a read-write iterator or false to open a read-only iterator. If the collection is read-only the iterator will always be read-only.
Returns: a StoredIterator for this collection.
Throws: IllegalStateException if writeAllowed is true but the collection is read-only. RuntimeExceptionWrapper if a DatabaseException is thrown.
See Also: StoredCollection
Throws: RuntimeExceptionWrapper if a DatabaseException is thrown.
Collection#toArray(Object[])
interface.
Throws: RuntimeExceptionWrapper if a DatabaseException is thrown.
Returns: an ArrayList containing a copy of all elements in this collection.
Throws: RuntimeExceptionWrapper if a DatabaseException is thrown.
Returns: the string representation.
Throws: RuntimeExceptionWrapper if a DatabaseException is thrown.