Collection<DocumentReference> (@NotNull ClientState state) { Set<DocumentReference> result = new HashSet<>(); state.myUndoStacksHolder.collectAllAffectedDocuments(result); state.myRedoStacksHolder.collectAllAffectedDocuments(result); return result; }