String (@NotNull String singularName, @NotNull BuilderInfo info) { final String codeBlockTemplate = "if({0}==null)'{'throw new NullPointerException(\"{0} cannot be null\");'}'\n" + "if (this.{0}" + LOMBOK_KEY + " == null) '{' \n" + "this.{0}" + LOMBOK_KEY + " = new java.util.ArrayList<{2}>(); \n" + "this.{0}" + LOMBOK_VALUE + " = new java.util.ArrayList<{3}>(); \n" + "'}' \n" + "for (final java.util.Map.Entry<{4},{5}> $lombokEntry : {0}.entrySet()) '{'\n" + "this.{0}" + LOMBOK_KEY + ".add($lombokEntry.getKey());\n" + "this.{0}" + LOMBOK_VALUE + ".add($lombokEntry.getValue());\n" + "'}'\n" + "return {1};"; final PsiType keyType = getKeyType(info.getManager(), info.getFieldType()); final PsiType valueType = getValueType(info.getManager(), info.getFieldType()); final PsiType keyIterType = PsiTypeUtil.extractAllElementType(info.getFieldType(), info.getManager(), CommonClassNames.JAVA_UTIL_MAP, 0); final PsiType valueIterType = PsiTypeUtil.extractAllElementType(info.getFieldType(), info.getManager(), CommonClassNames.JAVA_UTIL_MAP, 1); return MessageFormat.format(codeBlockTemplate, singularName, info.getBuilderChainResult(), keyType.getCanonicalText(false), valueType.getCanonicalText(false), keyIterType.getCanonicalText(false), valueIterType.getCanonicalText(false)); }