List<String> (@NotNull String name, @NotNull ImmutableCollectionModel model) { boolean isMapOfEntriesCall = "ofEntries".equals(model.myCall.getMethodExpression().getReferenceName()); List<String> updates = new ArrayList<>(); PsiExpression[] args = model.myCall.getArgumentList().getExpressions(); for (int i = 0; i < args.length; i++) { PsiExpression arg = args[i]; if (model.myType != CollectionType.MAP) { updates.add(String.format("%s.add(%s);", name, arg.getText())); } else if (isMapOfEntriesCall) { updates.add(String.format("%s.put(%s);", name, extractPutArgs(arg))); } else if (i % 2 != 0) { updates.add(String.format("%s.put(%s, %s);", name, args[i - 1].getText(), arg.getText())); } } return updates; }