| A collection of documents.
Classes implementing this interface have additional responsabilities
w.r.t.
it.unimi.dsi.mg4j.document.DocumentSequence in that they
must provide random access to the documents, and guarantee the possibility
of multiple calls to
it.unimi.dsi.mg4j.document.DocumentSequence.iterator .
Note, however, that the objects returned by
it.unimi.dsi.mg4j.document.DocumentSequence.iterator iterator() ,
DocumentCollection.stream(int) and
DocumentCollection.document(int) are, unless explicitly stated otherwise,
mutually exclusive. They share a single resource managed by the
collection (and disposed by a call to
java.io.Closeable.close close() ), so each time
a stream or a document are returned by some method, the ones previously returned are no longer
valid, and access to their methods will cause unpredictable behaviour. If you need many
documents, you can
of the collection.
Warning: implementations of this class are not required
to be thread-safe, but they provide
.
The
DocumentCollection.copy() method is strengthened so to return a instance of this class.
|