Changed the dictionary entry's equals method so no two words of the same type and language can be added.

This commit is contained in:
top19 2020-05-01 13:01:21 +01:00
parent 56c8aff326
commit 280930aa7f

View file

@ -99,8 +99,8 @@ public class DictionaryEntry {
@Override
public boolean equals(Object entry) {
DictionaryEntry otherEntry = (DictionaryEntry) entry;
return otherEntry.getEnglish().equalsIgnoreCase(this.getEnglish()) &&
otherEntry.getWelsh().equalsIgnoreCase(this.getWelsh()) &&
otherEntry.getWordType().equals(this.getWordType());
return ((this.getWelsh().equalsIgnoreCase(otherEntry.getWelsh()) || this.getEnglish().equalsIgnoreCase(otherEntry.getWelsh())) &&
this.getWordType().equals(otherEntry.getWordType()));
}
}