public Collection<TopLevelItem> getAllItems() {

        if (this instanceof ViewGroup) {
            final Collection<TopLevelItem> items = new LinkedHashSet<>(getItems());

            for(View view: ((ViewGroup) this).getViews()) {
                items.addAll(view.getAllItems());
            }
            return Collections.unmodifiableCollection(items);
        } else {
            return getItems();
        }
    }
public Collection < TopLevelItem > getAllItems ( ) { if ( this instanceof ViewGroup ) { final Collection < TopLevelItem > items = new LinkedHashSet < > ( getItems ( ) ) ; for ( View view : ( ( ViewGroup ) this ) . getViews ( ) ) { items . addAll ( view . getAllItems ( ) ) ; } return Collections . unmodifiableCollection ( items ) ; } else { return getItems ( ) ; } }
Gets all the items recursively contained in this collection in a read-only view.
<p>
The default implementation recursively adds the items of all contained Views
in case this view implements {@link ViewGroup}, which should be enough for most cases.

@since 1.520