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

Merge branch '54-add-equals-hash-methods-for-serializable-classes' into 'master'

Resolve "Add equals/hash methods for serializable classes"

Closes #54

See merge request !27
parents 9a99025b 15c44c70
No related branches found
No related tags found
1 merge request!27Resolve "Add equals/hash methods for serializable classes"
Pipeline #729 passed with warnings
package theodolite.uc4.streamprocessing;
import java.util.Objects;
/**
* Composed key of an hour of the day and a sensor id.
*/
......@@ -26,4 +28,22 @@ public class HourOfDayKey {
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