private Optional < ResolvedType > find ( Map < Node , ResolvedType > map , LambdaExpr lambdaExpr ) { for ( Node key : map . keySet ( ) ) { if ( key instanceof LambdaExpr ) { LambdaExpr keyLambdaExpr = ( LambdaExpr ) key ; if ( keyLambdaExpr . toString ( ) . equals ( lambdaExpr . toString ( ) ) && getParentNode ( keyLambdaExpr ) == getParentNode ( lambdaExpr ) ) { return Optional . of ( map . get ( keyLambdaExpr ) ) ; } } } return Optional . empty ( ) ; }
For some reasons LambdaExprs are duplicate and the equals method is not implemented correctly .