.
You must override the method equals()and hashCode()LabelValue.
And the method equals()should use the property nameas well as the method hashCode().
Then your code will work.
PS. I assume that your LabelValue objects can only be distinguished with the name property, which you seem to need anyway based on your question.
source
share