public int getSelectedItemCount() {
        int count = 0;
        for (int sectionIndex : selectionStateBySection.keySet()) {
            SectionSelectionState state = selectionStateBySection.get(sectionIndex);

            if (state.section) {

                count += getNumberOfItemsInSection(sectionIndex);

                if (doesSectionHaveFooter(sectionIndex)) {
                    count++;
                }
            } else {
                for (int i = 0, s = state.items.size(); i < s; i++) {
                    boolean selected = state.items.valueAt(i);
                    if (selected) {
                        count++;
                    }
                }
                if (state.footer) {
                    count++;
                }
            }
        }

        return count;
    }
Quick check if selection is empty

@return true iff the selection state is empty
android/modules/module_common/src/main/java/github/tornaco/android/thanos/widget/section/SectioningAdapter.java