@Test public void testKeepsDocumentsInTheRightOrder() { DocumentSet set = docSet(TEST_COMPARATOR, DOC1, DOC2, DOC3); assertEquals(Arrays.asList(DOC3, DOC1, DOC2), set.toList()); }
public List<Document> toList() { List<Document> documents = new ArrayList<>(size()); for (Document document : this) { documents.add(document); } return documents; }
DocumentSet implements Iterable<Document> { public List<Document> toList() { List<Document> documents = new ArrayList<>(size()); for (Document document : this) { documents.add(document); } return documents; } }
DocumentSet implements Iterable<Document> { public List<Document> toList() { List<Document> documents = new ArrayList<>(size()); for (Document document : this) { documents.add(document); } return documents; } private  DocumentSet(
      ImmutableSortedMap<DocumentKey, Document> keyIndex, ImmutableSortedSet<Document> sortedSet); }
DocumentSet implements Iterable<Document> { public List<Document> toList() { List<Document> documents = new ArrayList<>(size()); for (Document document : this) { documents.add(document); } return documents; } private  DocumentSet(
      ImmutableSortedMap<DocumentKey, Document> keyIndex, ImmutableSortedSet<Document> sortedSet); static DocumentSet emptySet(final Comparator<Document> comparator); int size(); boolean isEmpty(); boolean contains(DocumentKey key); @Nullable Document getDocument(DocumentKey key); @Nullable Document getFirstDocument(); @Nullable Document getLastDocument(); @Nullable Document getPredecessor(DocumentKey key); int indexOf(DocumentKey key); DocumentSet add(Document document); DocumentSet remove(DocumentKey key); List<Document> toList(); @Override @NonNull Iterator<Document> iterator(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString(); }
DocumentSet implements Iterable<Document> { public List<Document> toList() { List<Document> documents = new ArrayList<>(size()); for (Document document : this) { documents.add(document); } return documents; } private  DocumentSet(
      ImmutableSortedMap<DocumentKey, Document> keyIndex, ImmutableSortedSet<Document> sortedSet); static DocumentSet emptySet(final Comparator<Document> comparator); int size(); boolean isEmpty(); boolean contains(DocumentKey key); @Nullable Document getDocument(DocumentKey key); @Nullable Document getFirstDocument(); @Nullable Document getLastDocument(); @Nullable Document getPredecessor(DocumentKey key); int indexOf(DocumentKey key); DocumentSet add(Document document); DocumentSet remove(DocumentKey key); List<Document> toList(); @Override @NonNull Iterator<Document> iterator(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString();  }