diff --git a/spellchecker/src/com/intellij/spellchecker/grazie/async/WordListLoader.kt b/spellchecker/src/com/intellij/spellchecker/grazie/async/WordListLoader.kt index da652b8ed36c..e7513dd82d6b 100644 --- a/spellchecker/src/com/intellij/spellchecker/grazie/async/WordListLoader.kt +++ b/spellchecker/src/com/intellij/spellchecker/grazie/async/WordListLoader.kt @@ -69,12 +69,12 @@ internal class WordListLoader(private val project: Project, private val coroutin } private fun readAll(loader: Loader): Set { - val set = CollectionFactory.createSmallMemoryFootprintSet() + val words = mutableListOf() loader.load { ProgressManager.checkCanceled() - set.add(it) + words.add(it) } - return set + return CollectionFactory.createSmallMemoryFootprintSet(words) } private fun queueWordListLoad(loader: Loader, consumer: (String, WordList) -> Unit) { diff --git a/spellchecker/src/com/intellij/spellchecker/grazie/dictionary/SimpleWordList.kt b/spellchecker/src/com/intellij/spellchecker/grazie/dictionary/SimpleWordList.kt index cddd9ca7ab5a..c43f5ec074d6 100644 --- a/spellchecker/src/com/intellij/spellchecker/grazie/dictionary/SimpleWordList.kt +++ b/spellchecker/src/com/intellij/spellchecker/grazie/dictionary/SimpleWordList.kt @@ -14,7 +14,7 @@ internal class SimpleWordList(private val container: Set) : WordList { private val invariants = buildInvariants(container) private fun buildInvariants(container: Set): Set { - val result = CollectionFactory.createSmallMemoryFootprintSet() + val result = CollectionFactory.createSmallMemoryFootprintSet(container.size) for (entry in container) { ProgressManager.checkCanceled() result.add(entry.lowercase())