From 1557106d0e373f7efc15faed65f69eb567613a45 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 23 Feb 2019 09:49:56 +0100 Subject: [PATCH] Use Sequence instead of Collection --- src/main/kotlin/net/pterodactylus/sone/utils/Pagination.kt | 1 + src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/net/pterodactylus/sone/utils/Pagination.kt b/src/main/kotlin/net/pterodactylus/sone/utils/Pagination.kt index 772d9c4..5d48d61 100644 --- a/src/main/kotlin/net/pterodactylus/sone/utils/Pagination.kt +++ b/src/main/kotlin/net/pterodactylus/sone/utils/Pagination.kt @@ -44,3 +44,4 @@ class Pagination(private val originalItems: List, pageSize: Int): Iter } fun Iterable.paginate(pageSize: Int) = Pagination(toList(), pageSize) +fun Sequence.paginate(pageSize: Int) = Pagination(toList(), pageSize) diff --git a/src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt index 05bad4a..92a856a 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPage.kt @@ -17,7 +17,7 @@ class KnownSonesPage @Inject constructor(template: Template, webInterface: WebIn override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) { getCurrentSone(freenetRequest.toadletContext).let { currentSone -> - webInterface.core.sones + webInterface.core.sones.asSequence() .filterNot { freenetRequest.parameters["filter"] == "followed" && currentSone != null && !currentSone.hasFriend(it.id) } .filterNot { freenetRequest.parameters["filter"] == "not-followed" && currentSone != null && currentSone.hasFriend(it.id) } .filterNot { freenetRequest.parameters["filter"] == "new" && it.isKnown } -- 2.7.4