String comparisonequals() method should be used for content comparison instead. Unlike Java, the == operator in Apex compares object value equality and not reference equality. The exception is user-defined types. Thus, for sObjects and sObjects arrays comparison the == operator should be used.