Iterator<LookupElement> (LookupElement element) { List<LookupElement> toLift; synchronized (LiftShorterItemsClassifier.this) { toLift = new ArrayList<>(myToLift.get(element)); } List<LookupElement> shorter = addShorterElements(toLift); List<LookupElement> singleton = Collections.singletonList(element); if (shorter != null) { if (myLifted != null) { myLifted.addAll(shorter); } Iterable<LookupElement> lifted = myNext == null ? shorter : myNext.classify(shorter, myContext); return (myLiftBefore ? ContainerUtil.concat(lifted, singleton) : ContainerUtil.concat(singleton, lifted)).iterator(); } return singleton.iterator(); }