String (CommentTracker ct) { String operation = "flatMap"; PsiType inType = myVariable.getType(); PsiType outType = mySource.getVariable().getType(); String lambda = myVariable.getName() + " -> " + getStreamExpression(ct); if (outType instanceof PsiPrimitiveType && !outType.equals(inType)) { if (outType.equals(PsiTypes.intType())) { operation = "flatMapToInt"; } else if (outType.equals(PsiTypes.longType())) { operation = "flatMapToLong"; } else if (outType.equals(PsiTypes.doubleType())) { operation = "flatMapToDouble"; } } if (inType instanceof PsiPrimitiveType && !outType.equals(inType)) { return ".mapToObj(" + lambda + ")." + operation + "(" + CommonClassNames.JAVA_UTIL_FUNCTION_FUNCTION + ".identity())"; } return "." + operation + "(" + lambda + ")"; }