PsiElement[] (SurroundDescriptor descriptor, PsiFile file, int[] startOffsets, int[] endOffsets) { final List<PsiElement> elementList = new ArrayList<>(); for (int i = 0; i < startOffsets.length; ++i) { elementList.addAll(List.of(descriptor.getElementsToSurround(file, startOffsets[i], endOffsets[i]))); } return elementList.toArray(PsiElement[]::new); }