public int getPositionInSection(final int position) {
        int currentPos = 0;

        for (final Map.Entry<String, Section> entry : sections.entrySet()) {
            final Section section = entry.getValue();

            // ignore invisible sections
            if (!section.isVisible()) {
                continue;
            }

            final int sectionTotal = section.getSectionItemsTotal();

            // check if position is in this section
            if (position >= currentPos && position <= (currentPos + sectionTotal - 1)) {
                final int result = position - currentPos - (section.hasHeader() ? 1 : 0);
                if (result == -1 || result == section.getContentItemsTotal()) {
                    throw new IllegalArgumentException("This method is not applicable for header or footer position");
                }
                return result;
            }

            currentPos += sectionTotal;
        }

        throw new IndexOutOfBoundsException("Invalid position");
    }
Return the item position relative to the section.

@param position position of the item in the adapter
@return position of the item in the section
library/src/main/java/io/github/luizgrp/sectionedrecyclerviewadapter/SectionedRecyclerViewAdapter.java