From 011b7c8255b47c016c1eed3af55e9c2863da7b15 Mon Sep 17 00:00:00 2001 From: 1552980358 <1552980358@qq.com> Date: Wed, 9 Sep 2020 12:49:20 +0800 Subject: [PATCH] RssArticle.kt: Modify functions into assigning style Signed-off-by: 1552980358 <1552980358@qq.com> --- .../io/legado/app/data/entities/RssArticle.kt | 43 ++++++++----------- 1 file changed, 17 insertions(+), 26 deletions(-) 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