|
22 | 22 | import java.io.Serializable; |
23 | 23 | import java.util.Collections; |
24 | 24 | import java.util.List; |
| 25 | +import java.util.Objects; |
25 | 26 | import java.util.Set; |
26 | 27 | import java.util.concurrent.atomic.AtomicReference; |
27 | 28 | import java.util.stream.Collectors; |
@@ -95,6 +96,22 @@ public String toString() { |
95 | 96 | .add("watermarkUpdate", watermarkUpdate) |
96 | 97 | .toString(); |
97 | 98 | } |
| 99 | + |
| 100 | + @Override |
| 101 | + public int hashCode() { |
| 102 | + return Objects.hash(processingTime, element, watermarkUpdate); |
| 103 | + } |
| 104 | + |
| 105 | + @Override |
| 106 | + public boolean equals(Object other) { |
| 107 | + if (!(other instanceof Event)) { |
| 108 | + return false; |
| 109 | + } |
| 110 | + Event<?> otherEvent = (Event<?>) other; |
| 111 | + return Objects.equals(processingTime, otherEvent.processingTime) |
| 112 | + && Objects.equals(watermarkUpdate, otherEvent.watermarkUpdate) |
| 113 | + && Objects.equals(element, otherEvent.element); |
| 114 | + } |
98 | 115 | } |
99 | 116 |
|
100 | 117 | /** |
@@ -238,6 +255,21 @@ public WindowExpirationValue(@Nullable Instant watermarkAdvance, long value) { |
238 | 255 | this.watermarkAdvance = watermarkAdvance; |
239 | 256 | this.value = value; |
240 | 257 | } |
| 258 | + |
| 259 | + @Override |
| 260 | + public boolean equals(Object other) { |
| 261 | + if (!(other instanceof WindowExpirationValue)) { |
| 262 | + return false; |
| 263 | + } |
| 264 | + WindowExpirationValue otherValue = (WindowExpirationValue) other; |
| 265 | + return Objects.equals(watermarkAdvance, otherValue.watermarkAdvance) |
| 266 | + && value == otherValue.value; |
| 267 | + } |
| 268 | + |
| 269 | + @Override |
| 270 | + public int hashCode() { |
| 271 | + return Objects.hash(watermarkAdvance, value); |
| 272 | + } |
241 | 273 | } |
242 | 274 |
|
243 | 275 | @Test |
|
0 commit comments