Use equals() to compare strings contents

I believe we want to do the usual thing here and compare string contents instead of string references. If we really want to compare references we should probably add a comment explaining why.