diff --git a/app/src/main/java/io/legado/app/data/entities/RssArticle.kt b/app/src/main/java/io/legado/app/data/entities/RssArticle.kt index d9ae5531b..fda4769d2 100644 --- a/app/src/main/java/io/legado/app/data/entities/RssArticle.kt +++ b/app/src/main/java/io/legado/app/data/entities/RssArticle.kt @@ -19,32 +19,23 @@ data class RssArticle( var image: String? = null, var read: Boolean = false ) { - - override fun hashCode(): Int { - return link.hashCode() - } - + + override fun hashCode() = link.hashCode() + override fun equals(other: Any?): Boolean { - if (other == null) { - return false - } - if (other is RssArticle) { - return origin == other.origin && link == other.link - } - return false - } - - fun toStar(): RssStar { - return RssStar( - origin = origin, - sort = sort, - title = title, - starTime = System.currentTimeMillis(), - link = link, - pubDate = pubDate, - description = description, - content = content, - image = image - ) + other ?: return false + return if (other is RssArticle) origin == other.origin && link == other.link else false } + + fun toStar() = RssStar( + origin = origin, + sort = sort, + title = title, + starTime = System.currentTimeMillis(), + link = link, + pubDate = pubDate, + description = description, + content = content, + image = image + ) } \ No newline at end of file