ModCommand (@NotNull PsiMethod method, @NotNull List<PsiParameter> parameters, @NotNull Function<List<PsiParameter>, ModCommand> function) { if (parameters.size() < 2) { return function.apply(parameters); } List<@NotNull ParameterClassMember> members = sortByParameterIndex( ContainerUtil.map(parameters, ParameterClassMember::new), method); List<ParameterClassMember> selection = getInitialSelection(method, members); return new ModChooseMember(JavaBundle.message("dialog.title.choose.0.parameters", method.isConstructor() ? "Constructor" : "Method"), members, selection, ModChooseMember.SelectionMode.MULTIPLE, function.compose(elements -> ContainerUtil.map(elements, e -> ((ParameterClassMember)e).getParameter()))); }