Collection<PsiVariable> () { Map<PsiVariable, Boolean> vars = myContext.getUserData(VARS[myFixType]); if (vars == null) { vars = ((UserDataHolderEx)myContext).putUserDataIfAbsent(VARS[myFixType], ContainerUtil.createConcurrentWeakMap()); } final Map<PsiVariable, Boolean> finalVars = vars; return new AbstractCollection<>() { @Override public boolean add(PsiVariable psiVariable) { return finalVars.put(psiVariable, Boolean.TRUE) == null; } @NotNull @Override public Iterator<PsiVariable> iterator() { return finalVars.keySet().iterator(); } @Override public int size() { return finalVars.size(); } }; }