From e384d634ccc8ba7ab4dae68955a067d923852372 Mon Sep 17 00:00:00 2001 From: Graham Date: Sun, 3 Jan 2021 15:31:44 +0000 Subject: [PATCH] Reduce allocations if a singleton set is already mutable Signed-off-by: Graham --- cache/src/main/kotlin/org/openrs2/cache/NamedEntryCollection.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cache/src/main/kotlin/org/openrs2/cache/NamedEntryCollection.kt b/cache/src/main/kotlin/org/openrs2/cache/NamedEntryCollection.kt index 7c78ea1c..f29c3c27 100644 --- a/cache/src/main/kotlin/org/openrs2/cache/NamedEntryCollection.kt +++ b/cache/src/main/kotlin/org/openrs2/cache/NamedEntryCollection.kt @@ -249,7 +249,7 @@ public abstract class NamedEntryCollection( val set = nameHashTable[newNameHash] when { set == null -> nameHashTable[newNameHash] = IntSortedSets.singleton(id) - set.size == 1 -> { + set is IntSortedSets.Singleton -> { val newSet = IntAVLTreeSet() newSet.add(set.firstInt()) newSet.add(id)