Skip to content

Commit

Permalink
added equals and hashcode override to GSRReservation
Browse files Browse the repository at this point in the history
  • Loading branch information
joemacd committed Mar 22, 2024
1 parent 1619f8f commit 2609462
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,21 @@ class GSRReservation {
@Expose
@JvmField
var info: Map<String, String>? = null

override fun equals(other: Any?): Boolean {
return other is GSRReservation && this.booking_id == other.booking_id && this.name == other.name
&& this.fromDate == other.fromDate && this.toDate == other.toDate && this.gid == other.gid
&& this.lid == other.lid //maybe toss in info here
}

override fun hashCode(): Int {
var result = (booking_id?.hashCode() ?: 0)
result = 31 * result + (name?.hashCode() ?: 0)
result = 31 * result + (fromDate?.hashCode() ?: 0)
result = 31 * result + (toDate?.hashCode() ?: 0)
result = 31 * result + (gid?.hashCode() ?: 0)
result = 31 * result + (lid?.hashCode() ?: 0)
result = 31 * result + (info?.hashCode() ?: 0)
return result
}
}

0 comments on commit 2609462

Please sign in to comment.