Improving the memory use of hashmaps

This commit is contained in:
Vitor Pamplona
2023-12-21 15:26:01 -05:00
parent 6fb5c873cc
commit 2ce16325a1
5 changed files with 38 additions and 23 deletions
@@ -124,6 +124,9 @@ open class Event(
ATag.parse(aTagValue, relay)
}
override fun hasHashtags() = tags.any { it.size > 1 && it[0] == "t" }
override fun hasGeohashes() = tags.any { it.size > 1 && it[0] == "g" }
override fun hashtags() = tags.filter { it.size > 1 && it[0] == "t" }.map { it[1] }
override fun geohashes() = tags.filter { it.size > 1 && it[0] == "g" }.map { it[1] }
@@ -55,6 +55,9 @@ interface EventInterface {
fun expiration(): Long?
fun hasHashtags(): Boolean
fun hasGeohashes(): Boolean
fun hashtags(): List<String>
fun geohashes(): List<String>