List<CaretState> (List<? extends CaretState> caretStates) { List<CaretState> convertedStates = new ArrayList<>(caretStates.size()); for (CaretState state : caretStates) { convertedStates.add(new CaretState(injectedToHost(state.getCaretPosition()), injectedToHost(state.getSelectionStart()), injectedToHost(state.getSelectionEnd()))); } return convertedStates; }