A collection of documents.
Classes implementing this interface have additional responsibilities w.r.t. {@link it.unimi.dsi.mg4j.document.DocumentSequence} in that theymust provide random access to the documents, and guarantee the possibility of multiple calls to {@link it.unimi.dsi.mg4j.document.DocumentSequence#iterator()}.
Note, however, that the objects returned by {@link it.unimi.dsi.mg4j.document.DocumentSequence#iterator() iterator()}, {@link #stream(int)} and {@link #document(int)} are, unless explicitly stated otherwise,mutually exclusive. They share a single resource managed by the collection (and disposed by a call to {@link 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 {@linkplain FlyweightPrototype#copy() obtain a flyweight copy}of the collection.
Warning: implementations of this class are not required to be thread-safe, but they provide {@linkplain FlyweightPrototype flyweight copies}. The {@link #copy()} method is strengthened so to return a instance of this class.