void (@NotNull GrListOrMap listOrMap) { final PsiType type = listOrMap.getType(); LOG.assertTrue(type instanceof PsiClassType); if (listOrMap.isMap()) { if (listOrMap.getNamedArguments().length == 0) { builder.append("new "); TypeWriter.writeTypeForNew(builder, type, listOrMap); builder.append("()"); } else { String varName = generateMapVariableDeclaration(listOrMap, type); generateMapElementInsertions(listOrMap, varName); builder.append(varName); } } else { builder.append("new "); PsiType typeToUse = getTypeToUseByList(listOrMap, type); TypeWriter.writeTypeForNew(builder, typeToUse, listOrMap); if (typeToUse instanceof PsiArrayType) { if (listOrMap.getInitializers().length == 0) { builder.replace(builder.length() - 2, builder.length(), "[0]"); } else { builder.append('{'); genInitializers(listOrMap); builder.append('}'); } } else if (listOrMap.getInitializers().length == 0) { builder.append("()"); } else { builder.append("(java.util.Arrays.asList("); genInitializers(listOrMap); builder.append("))"); } } }