Skip to content

Commit 715b323

Browse files
committed
#110 Adding equals and hash for VStringArray
1 parent b4c549a commit 715b323

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

epics-vtype/vtype/src/main/java/org/epics/vtype/VStringArray.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.epics.vtype;
22

33
import java.util.List;
4+
import java.util.Objects;
45

56
import org.epics.util.array.ArrayInteger;
67
import org.epics.util.array.ListInteger;
@@ -39,5 +40,29 @@ public String toString() {
3940
.append(']');
4041
return builder.toString();
4142
}
43+
44+
@Override
45+
public final boolean equals(Object obj) {
46+
if (this == obj) {
47+
return true;
48+
}
49+
if (obj instanceof VStringArray) {
50+
VStringArray other = (VStringArray) obj;
51+
return getClass().equals(other.getClass()) &&
52+
getData().equals(other.getData()) &&
53+
getAlarm().equals(other.getAlarm()) &&
54+
getTime().equals(other.getTime());
55+
}
56+
return false;
57+
}
58+
59+
@Override
60+
public final int hashCode() {
61+
int hash = 7;
62+
hash = 23 * hash + Objects.hashCode(getData());
63+
hash = 23 * hash + Objects.hashCode(getAlarm());
64+
hash = 23 * hash + Objects.hashCode(getTime());
65+
return hash;
66+
}
4267

4368
}

0 commit comments

Comments
 (0)