List<CaretState> () { synchronized (myCarets) { List<CaretState> states = new ArrayList<>(myCarets.size()); for (CaretImpl caret : myCarets) { states.add(new CaretState(caret.getLogicalPosition(), caret.myVisualColumnAdjustment, caret.getSelectionStartLogicalPosition(), caret.getSelectionEndLogicalPosition())); } return states; } }