CallHandler<CallChainSimplification> () { return CallHandler.of(MAP_TO_OBJ, call -> { PsiExpression arg = call.getArgumentList().getExpressions()[0]; PsiType type = StreamApiUtil.getStreamElementType(call.getType()); PsiClass targetClass = PsiUtil.resolveClassInClassTypeOnly(type); if (targetClass == null) return null; PsiExpression qualifier = call.getMethodExpression().getQualifierExpression(); if (qualifier == null || !TypeConversionUtil.boxingConversionApplicable(StreamApiUtil.getStreamElementType(qualifier.getType()), type) || !isBoxingFunction(arg, targetClass)) { return null; } return new ReplaceWithBoxedFix(); }); }