Skip to content

Commit 63fecf2

Browse files
committed
Make the hashCode implementation position-dependent
1 parent e01caa8 commit 63fecf2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core/common/src/format/LocalDateFormat.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,10 @@ internal class IncompleteLocalDate(
279279
other is IncompleteLocalDate && year == other.year && monthNumber == other.monthNumber &&
280280
dayOfMonth == other.dayOfMonth && isoDayOfWeek == other.isoDayOfWeek && dayOfYear == other.dayOfYear
281281

282-
override fun hashCode(): Int =
283-
year.hashCode() + monthNumber.hashCode() + dayOfMonth.hashCode() + isoDayOfWeek.hashCode() +
282+
override fun hashCode(): Int = year.hashCode() * 923521 +
283+
monthNumber.hashCode() * 29791 +
284+
dayOfMonth.hashCode() * 961 +
285+
isoDayOfWeek.hashCode() * 31 +
284286
dayOfYear.hashCode()
285287

286288
override fun toString(): String =

0 commit comments

Comments
 (0)