Skip to content

Commit 97ec0c3

Browse files
author
Julian Kast
committed
Update custom hashCode method to match IOS
1 parent 063b650 commit 97ec0c3

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

base/src/main/java/com/smartdevicelink/managers/screen/menu/VoiceCommand.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,8 @@ private HashSet<String> removeDuplicateStrings(List<String> voiceCommands) {
140140
@Override
141141
public int hashCode() {
142142
int result = 1;
143-
result += Integer.rotateLeft(getCommandId(), 1);
144143
for (int i = 0; i < this.getVoiceCommands().size(); i++) {
145-
result += ((getVoiceCommands().get(i) == null) ? 0 : Integer.rotateLeft(getVoiceCommands().get(i).hashCode(), i + 2));
144+
result += ((getVoiceCommands().get(i) == null) ? 0 : Integer.rotateLeft(getVoiceCommands().get(i).hashCode(), i + 1));
146145
}
147146
return result;
148147
}
@@ -158,7 +157,7 @@ public boolean equals(Object o) {
158157
if (o == null) return false;
159158
// if this is the same memory address, it's the same
160159
if (this == o) return true;
161-
// if this is not an instance of SoftButtonObject, not the same
160+
// if this is not an instance of VoiceCommand, not the same
162161
if (!(o instanceof VoiceCommand)) return false;
163162
// return comparison
164163
return hashCode() == o.hashCode();

0 commit comments

Comments
 (0)