Skip to content

Commit

Permalink
VideoSize: use kotlin-derived equals
Browse files Browse the repository at this point in the history
equals() is the same as comparing each field, so we can use the Kotlin
impl, same for hashCode()
  • Loading branch information
Profpatsch committed Nov 29, 2024
1 parent f8dd665 commit 23f88e0
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions new-player/src/main/java/net/newpipe/newplayer/data/VideoSize.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,6 @@ internal data class VideoSize(

override fun compareTo(other: VideoSize) = width * height - other.width * other.height

override fun equals(other: Any?) =
when (other) {
is VideoSize ->
other.width == this.width && other.height == this.height && pixelWidthHeightRatio == other.pixelWidthHeightRatio

else -> false
}

override fun hashCode() =
width + height * 999999 + (pixelWidthHeightRatio*10000).toInt()

fun getRatio() =
(width * pixelWidthHeightRatio) / height

Expand Down

0 comments on commit 23f88e0

Please sign in to comment.