@Override public Set<RankedWordProposal> getProposals(final String word, final boolean sentence) { // synchronizing might not be needed here since getProposals is // a read-only access and only called in the same thread as // the modifing methods add/removeDictionary (?) Set<ISpellDictionary> copy; synchronized (fDictionaries) { copy = new HashSet<>(fDictionaries); } ISpellDictionary dictionary = null; final HashSet<RankedWordProposal> proposals = new HashSet<>(); for (final Iterator<ISpellDictionary> iterator = copy.iterator(); iterator.hasNext(); ) { dictionary = iterator.next(); proposals.addAll(dictionary.getProposals(word, sentence)); } return proposals; }