private @NotNull List<UndoRedoList<UndoableGroup>> getAffectedStacks(boolean global, @NotNull Collection<? extends DocumentReference> refs) {
    List<UndoRedoList<UndoableGroup>> result = new ArrayList<>(refs.size() + 1);
    if (global) result.add(myGlobalStack);
    for (DocumentReference ref : refs) {
      result.add(getStack(ref));
    }
    return result;
  }
private @NotNull List<UndoRedoList<UndoableGroup>> getAffectedStacks(boolean global, @NotNull Collection<? extends DocumentReference> refs)