Skip to content
Snippets Groups Projects
Commit 15c44c70 authored by Sören Henning's avatar Sören Henning
Browse files

Add hashCode and equals method

parent 9a99025b
No related branches found
No related tags found
1 merge request!27Resolve "Add equals/hash methods for serializable classes"
Pipeline #727 passed with warnings
package theodolite.uc4.streamprocessing; package theodolite.uc4.streamprocessing;
import java.util.Objects;
/** /**
* Composed key of an hour of the day and a sensor id. * Composed key of an hour of the day and a sensor id.
*/ */
...@@ -26,4 +28,22 @@ public class HourOfDayKey { ...@@ -26,4 +28,22 @@ public class HourOfDayKey {
return this.sensorId + ";" + this.hourOfDay; return this.sensorId + ";" + this.hourOfDay;
} }
@Override
public int hashCode() {
return Objects.hash(this.hourOfDay, this.sensorId);
}
@Override
public boolean equals(final Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof HourOfDayKey) {
final HourOfDayKey other = (HourOfDayKey) obj;
return Objects.equals(this.hourOfDay, other.hourOfDay)
&& Objects.equals(this.sensorId, other.sensorId);
}
return false;
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment