question: private int calculateIndex ( int index ) { index = index - ( hasHeader ( ) ? 1 : 0 ) ; if ( index >= items . size ( ) ) { throw new IllegalStateException ( "Index has to be defined in range from 0 to items.size() - 1!" ) ; } else { return index ; } }
target:  Calculate the correct item index - we have to subtract the number of headers of index value as the RecyclerView doesn't distinguish between header rows and item rows.