I have this method:
private static void searchChannelByName(String name, ArrayList<VeediChannel> channel,HashSet<VeediChannel> newChannelsList)
{
if(channel!=null) {
for (int i = 0; i < channel.size(); i++) {
if (channel.get(i).getName().toUpperCase().contains(name))
newChannelsList.add(channel.get(i));
}
}
}
I want to override to set the logic in which the set add is done (for preventing duplicates) so in VeediChannel class i am doing this:
@Override
public boolean equals(Object o)
{
Log.i(Utils.TAG,"In equals");
if(this.getName().equals(((VeediChannel) o).getName()))
return true;
else
return false;
}
So when the add method is called on the newChannelsList the equals is supposed to be called
but, when checking the logs the equals method dont get call at all What seems to be the problem?