aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt
index 242d06cf0..c0626fccb 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeLimitedSet.kt
@@ -23,5 +23,7 @@ class TimeLimitedSet<T : Any>(
fun clear() = cache.clear()
- fun toSet(): Set<T> = cache.keys().toSet()
+ fun toSet(): Set<T> = cache.keys().let { keys ->
+ if (keys.isEmpty()) emptySet() else keys.toSet()
+ }
}