@NotNull
  private Iterable<FoldedBlock> getFoldedBlocks() {
    return () -> new Iterator<>() {
      private int myGroupIndex = 0;
      private int myBlockIndex = 0;

      @Override
      public boolean hasNext() {
        return myGroupIndex < myFoldings.size();
      }

      @Override
      public FoldedBlock next() {
        FoldedGroup group = myFoldings.get(myGroupIndex);
        FoldedBlock folding = group.blocks.get(myBlockIndex);

        if (group.blocks.size() > myBlockIndex + 1) {
          myBlockIndex++;
        }
        else {
          myGroupIndex++;
          myBlockIndex = 0;
        }

        return folding;
      }

      @Override
      public void remove() {
        throw new UnsupportedOperationException();
      }
    };
  }
@NotNull
  private Iterable<FoldedBlock> getFoldedBlocks()