code: public boolean hasNewHeader(int position, boolean isReverseLayout) {
          if (indexOutOfBounds(position)) {
              return false;
          }
  
          int originalPosition = moPubRecyclerAdapter.getOriginalPosition(position);
          if (originalPosition < 0) {
              return false;
          }
  
          long headerId = mAdapter.getHeaderId(originalPosition);
  
          if (headerId < 0) {
              return false;
          }
  
          long nextItemHeaderId = -1;
          int nextItemPosition = originalPosition + (isReverseLayout ? 1 : -1);
          if (!indexOutOfBounds(nextItemPosition)) {
              nextItemHeaderId = mAdapter.getHeaderId(nextItemPosition);
          }
          int firstItemPosition = isReverseLayout ? moPubRecyclerAdapter.getItemCount() - 1 : 0;
  
          return originalPosition == firstItemPosition || headerId != nextItemHeaderId;
      }
docs: Determines if an item in the list should have a header that is different than the item in the
  list that immediately precedes it. Items with no headers will always return false.
  
  @param position        of the list item in questions
  @param isReverseLayout TRUE if layout manager has flag isReverseLayout
  @return true if this item has a different header than the previous item in the list
  @see {@link StickyRecyclerHeadersAdapter#getHeaderId(int)}