Skip to content

Commit d91b26a

Browse files
author
roman_tcaregorodtcev
committed
Equals and hashCode methods added
1 parent e3fface commit d91b26a

File tree

1 file changed

+23
-0
lines changed
  • omegatypes/src/main/java/com/omega_r/libs/omegatypes

1 file changed

+23
-0
lines changed

omegatypes/src/main/java/com/omega_r/libs/omegatypes/Text.kt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,29 @@ open class Text(protected val defaultTextStyle: TextStyle?) : Serializable, Text
245245
return context.resources.getQuantityString(res, quantity, *formatArgs)
246246
}
247247

248+
override fun equals(other: Any?): Boolean {
249+
if (this === other) return true
250+
if (javaClass != other?.javaClass) return false
251+
if (!super.equals(other)) return false
252+
253+
other as PluralsText
254+
255+
if (res != other.res) return false
256+
if (quantity != other.quantity) return false
257+
if (!formatArgs.contentEquals(other.formatArgs)) return false
258+
259+
return true
260+
}
261+
262+
override fun hashCode(): Int {
263+
var result = super.hashCode()
264+
result = 31 * result + res
265+
result = 31 * result + quantity
266+
result = 31 * result + formatArgs.contentHashCode()
267+
return result
268+
}
269+
270+
248271
}
249272

250273
private class ArrayText internal constructor(

0 commit comments

Comments
 (0)