This is wrong, you are comparing strings with == instead of .equals(), also you need to to do a null check on the other ConceptNameTag otherwise you will get a NPE if it tag is null when calling trim()