List<RefElement> () { List<RefElement> answer = myCachedSortedRefs; if (answer != null) return answer; answer = getElements(); List<RefElement> list = answer; ReadAction.run(() -> ContainerUtil.quickSort(list, (o1, o2) -> { VirtualFile v1 = ((RefElementImpl)o1).getVirtualFile(); VirtualFile v2 = ((RefElementImpl)o2).getVirtualFile(); int v21 = VfsUtilCore.compareByPath(v1, v2); if (v21 != 0) { return v21; } Segment r1 = ObjectUtils.notNull(o1.getPointer().getRange(), TextRange.EMPTY_RANGE); Segment r2 = ObjectUtils.notNull(o2.getPointer().getRange(), TextRange.EMPTY_RANGE); return Segment.BY_START_OFFSET_THEN_END_OFFSET.compare(r1, r2); })); myCachedSortedRefs = answer = Collections.unmodifiableList(answer); return answer; }