Use Sequence instead of Collection
[Sone.git] / src / main / kotlin / net / pterodactylus / sone / web / pages / KnownSonesPage.kt
index aa4b2db..92a856a 100644 (file)
@@ -7,16 +7,17 @@ import net.pterodactylus.sone.web.WebInterface
 import net.pterodactylus.sone.web.page.FreenetRequest
 import net.pterodactylus.util.template.Template
 import net.pterodactylus.util.template.TemplateContext
+import javax.inject.Inject
 
 /**
  * This page shows all known Sones.
  */
-class KnownSonesPage(template: Template, webInterface: WebInterface):
+class KnownSonesPage @Inject constructor(template: Template, webInterface: WebInterface):
                SoneTemplatePage("knownSones.html", webInterface, template, "Page.KnownSones.Title") {
 
        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 }