Skip to content

Commit

Permalink
For mozilla-mobile#12361 - Implement equals and hashCode methods for …
Browse files Browse the repository at this point in the history
…SearchRequest
  • Loading branch information
Alexandru2909 committed Jun 21, 2022
1 parent 8bda73a commit 897a340
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,19 @@ package mozilla.components.concept.engine.search
/**
* Value type that represents a request for showing a search to the user.
*/
data class SearchRequest(val isPrivate: Boolean, val query: String)
data class SearchRequest(val isPrivate: Boolean, val query: String) {
override fun equals(other: Any?): Boolean {
if (other === this) return true
if (other !is SearchRequest) return false
if (other.isPrivate != this.isPrivate) return false
if (other.query != this.query) return false
return true
}

override fun hashCode(): Int {
/* auto-generated */
var result = isPrivate.hashCode()
result = 31 * result + query.hashCode()
return result
}
}

0 comments on commit 897a340

Please sign in to comment.