@SuppressWarnings("unchecked")
    private List<PageElement> createElementList(@SuppressWarnings("rawtypes") Class pageTemplateModelElementClass) {
        List<PageElement> filteredElements=new ArrayList<>();
        for (PageElement element : elements) {
            if (pageTemplateModelElementClass.isAssignableFrom(element.getClass()))
                filteredElements.add(element);
            else if (element instanceof AbstractChoice)
                if (((AbstractChoice)element).isChoiceBetween(pageTemplateModelElementClass))
                    filteredElements.add(element);
        }
        return Collections.unmodifiableList(filteredElements);
    }
Convenience method which returns the elements <b>and choices</b> of the given type in elements as a
read-only list. Not that as this returns both concrete elements and choices betwen them,
the list element cannot be case to the given class - this must be used in conjunction
with a resolve which contains the resolution to the choices.

@param pageTemplateModelElementClass type to returns elements and choices of, a subtype of PageElement
container-search/src/main/java/com/yahoo/search/pagetemplates/model/Section.java