private void updateEqualSets ( Set < AbstractExpression > values , HashMap < AbstractExpression , Set < AbstractExpression > > valueEquivalence , Set < Set < AbstractExpression > > eqSets , AbstractExpression tveKey , AbstractExpression spExpr ) { boolean hasLegacyValues = false ; if ( eqSets . contains ( values ) ) { eqSets . remove ( values ) ; hasLegacyValues = true ; } values . add ( spExpr ) ; values . add ( tveKey ) ; if ( hasLegacyValues ) { eqSets . add ( values ) ; } valueEquivalence . put ( spExpr , values ) ; valueEquivalence . put ( tveKey , values ) ; }
Because HashSet stored a legacy hashcode for the non - final object .