♻️ Use method references
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 11 Apr 2024 07:41:29 +0000 (09:41 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 11 Apr 2024 07:41:29 +0000 (09:41 +0200)
src/main/kotlin/net/pterodactylus/rhynodge/filters/webpages/epicgames/EpicGamesFilter.kt

index 31bb11f..36d007c 100644 (file)
@@ -25,9 +25,9 @@ class EpicGamesFilter : Filter {
 
        private fun getPromotionalOfferDate(gameJson: JsonNode, date: String) = listOf("promotionalOffers", "upcomingPromotionalOffers")
                .map { "/promotions/$it/0/promotionalOffers/0/$date" }
-               .map { gameJson.at(it) }
-               .filter { !it.isMissingNode }
-               .map { it.asText() }
+               .map(gameJson::at)
+               .filterNot(JsonNode::isMissingNode)
+               .map(JsonNode::asText)
                .map(Instant::parse)
                .first()