File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
src/main/java/com/arpnetworking/tsdcore/statistics Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 16
16
package com .arpnetworking .tsdcore .statistics ;
17
17
18
18
import com .google .common .base .MoreObjects ;
19
+ import com .google .common .base .Supplier ;
20
+ import com .google .common .base .Suppliers ;
19
21
20
22
import java .util .Collections ;
21
23
import java .util .Set ;
@@ -39,7 +41,7 @@ public Set<Statistic> getDependencies() {
39
41
40
42
@ Override
41
43
public int hashCode () {
42
- return getClass (). hashCode ();
44
+ return _hashCodeSupplier . get ();
43
45
}
44
46
45
47
@ Override
@@ -57,5 +59,7 @@ public String toString() {
57
59
.toString ();
58
60
}
59
61
62
+ private final Supplier <Integer > _hashCodeSupplier = Suppliers .memoize (() -> getClass ().hashCode ());
63
+
60
64
private static final long serialVersionUID = -1334453626232464982L ;
61
65
}
Original file line number Diff line number Diff line change @@ -84,6 +84,23 @@ public Quantity calculateAggregations(final List<AggregatedData> aggregations) {
84
84
return allSamples .get (index );
85
85
}
86
86
87
+ @ Override
88
+ public int hashCode () {
89
+ return getName ().hashCode ();
90
+ }
91
+
92
+ @ Override
93
+ public boolean equals (final Object o ) {
94
+ if (this == o ) {
95
+ return true ;
96
+ }
97
+ if (!(o instanceof TPStatistic )) {
98
+ return false ;
99
+ }
100
+ final TPStatistic otherTPStatistic = (TPStatistic ) o ;
101
+ return getName ().equals (otherTPStatistic .getName ());
102
+ }
103
+
87
104
/**
88
105
* Public constructor.
89
106
*
You can’t perform that action at this time.
0 commit comments