String (@NotNull Editor editor, boolean addCarets, boolean addSelections) { StringBuilder sb = new StringBuilder(editor.getDocument().getCharsSequence()); ContainerUtil.reverse(editor.getCaretModel().getAllCarets()).forEach( caret -> ContainerUtil.reverse(getCaretMacros(caret, addCarets, addSelections)).forEach( pair -> sb.insert(pair.first, pair.second))); return sb.toString(); }