code: @SuppressWarnings("unused")
      private void switchHeaders(SparseArrayCompat<ViewHolder> map, int fromIndex, int toIndex, int type) {
          ViewHolder fromVh = map.get(fromIndex);
  
          if (fromVh != null) {
              map.remove(fromIndex);
              if (type == ViewHolderType.COLUMN_HEADER) {
                  fromVh.setColumnIndex(toIndex);
              } else if (type == ViewHolderType.ROW_HEADER) {
                  fromVh.setRowIndex(toIndex);
              }
          }
  
          ViewHolder toVh = map.get(toIndex);
          if (toVh != null) {
              map.remove(toIndex);
              if (type == ViewHolderType.COLUMN_HEADER) {
                  toVh.setColumnIndex(fromIndex);
              } else if (type == ViewHolderType.ROW_HEADER) {
                  toVh.setRowIndex(fromIndex);
              }
          }
  
          if (fromVh != null) {
              map.put(toIndex, fromVh);
          }
  
          if (toVh != null) {
              map.put(fromIndex, toVh);
          }
      }
docs: Method switch view holders in map (map with headers view holders).
  
  @param map       header view holder's map
  @param fromIndex index from view holder
  @param toIndex   index to view holder
  @param type      type of items (column header or row header)