import { Document } from './document'; import { DocumentComparator } from './document_comparator'; import { DocumentKey } from './document_key'; /** * DocumentSet is an immutable (copy-on-write) collection that holds documents * in order specified by the provided comparator. We always add a document key * comparator on top of what is provided to guarantee document equality based on * the key. */ export declare class DocumentSet { /** * Returns an empty copy of the existing DocumentSet, using the same * comparator. */ static emptySet(oldSet: DocumentSet): DocumentSet; private comparator; private keyedMap; private sortedSet; /** The default ordering is by key if the comparator is omitted */ constructor(comp?: DocumentComparator); has(key: DocumentKey): boolean; get(key: DocumentKey): Document | null; first(): Document | null; last(): Document | null; isEmpty(): boolean; /** * Returns the index of the provided key in the document set, or -1 if the * document key is not present in the set; */ indexOf(key: DocumentKey): number; readonly size: number; /** Iterates documents in order defined by "comparator" */ forEach(cb: (doc: Document) => void): void; /** Inserts or updates a document with the same key */ add(doc: Document): DocumentSet; /** Deletes a document with a given key */ delete(key: DocumentKey): DocumentSet; isEqual(other: DocumentSet | null | undefined): boolean; toString(): string; private copy(keyedMap, sortedSet); }