code: private void handleSelection(@Nullable View view, Item item, int position) {
          //if this item is not selectable don't continue
          if (!item.isSelectable()) {
              return;
          }
  
          //if we have disabled deselection via click don't continue
          if (item.isSelected() && !mAllowDeselection) {
              return;
          }
  
          boolean selected = item.isSelected();
  
          if (mSelectWithItemUpdate || view == null) {
              if (!mMultiSelect) {
                  deselect();
              }
              if (selected) {
                  deselect(position);
              } else {
                  select(position);
              }
          } else {
              if (!mMultiSelect) {
                  //we have to separately handle deselection here because if we toggle the current item we do not want to deselect this first!
                  Set<Item> selections = getSelectedItems();
                  selections.remove(item);
                  deselectByItems(selections);
              }
  
              //we toggle the state of the view
              item.withSetSelected(!selected);
              view.setSelected(!selected);
  
              //notify that the selection changed
              if (mSelectionListener != null)
                  mSelectionListener.onSelectionChanged(item, !selected);
          }
      }
docs: handles the selection and deselects item if multiSelect is disabled
  
  @param position the global position