### Question:
DocumentSet implements Iterable<Document> { @Nullable public Document getPredecessor(DocumentKey key) { Document document = keyIndex.get(key); if (document == null) { throw new IllegalArgumentException("Key not contained in DocumentSet: " + key); } return sortedSet.getPredecessorEntry(document); } 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();  }### Answer:
@Test public void testPredecessorDocumentForKey() { DocumentSet set = docSet(TEST_COMPARATOR, DOC1, DOC2, DOC3); assertNull(set.getPredecessor(DOC3.getKey())); assertEquals(DOC3, set.getPredecessor(DOC1.getKey())); assertEquals(DOC1, set.getPredecessor(DOC2.getKey())); }