private void handleSelection(View view,Item item,int position){
  if (!item.isSelectable()) {
    return;
  }
  if (item.isSelected() && !mAllowDeselection) {
    return;
  }
  boolean selected=false;
  if (mPositionBasedStateManagement) {
    selected=mSelections.contains(position);
  }
 else {
    selected=item.isSelected();
  }
  if (mSelectWithItemUpdate || view == null) {
    if (!mMultiSelect) {
      deselect();
    }
    if (selected) {
      deselect(position);
    }
 else {
      select(position);
    }
  }
 else {
    if (!mMultiSelect) {
      if (mPositionBasedStateManagement) {
        Iterator<Integer> entries=mSelections.iterator();
        while (entries.hasNext()) {
          Integer pos=entries.next();
          if (pos != position) {
            deselect(pos,entries);
          }
        }
      }
 else {
        Set<Integer> selections=getSelections();
        for (        int pos : selections) {
          if (pos != position) {
            deselect(pos);
          }
        }
      }
    }
    item.withSetSelected(!selected);
    view.setSelected(!selected);
    if (mSelectionListener != null)     mSelectionListener.onSelectionChanged(item,!selected);
    if (mPositionBasedStateManagement) {
      if (selected) {
        if (mSelections.contains(position)) {
          mSelections.remove(position);
        }
      }
 else {
        mSelections.add(position);
      }
    }
  }
}

private void handleSelection ( View view , Item item , int position ) { if ( ! item . isSelectable ( ) ) { return ; } if ( item . isSelected ( ) && ! mAllowDeselection ) { return ; } boolean selected = false ; if ( mPositionBasedStateManagement ) { selected = mSelections . contains ( position ) ; } else { selected = item . isSelected ( ) ; } if ( mSelectWithItemUpdate || view == null ) { if ( ! mMultiSelect ) { deselect ( ) ; } if ( selected ) { deselect ( position ) ; } else { select ( position ) ; } } else { if ( ! mMultiSelect ) { if ( mPositionBasedStateManagement ) { Iterator < Integer > entries = mSelections . iterator ( ) ; while ( entries . hasNext ( ) ) { Integer pos = entries . next ( ) ; if ( pos != position ) { deselect ( pos , entries ) ; } } } else { Set < Integer > selections = getSelections ( ) ; for ( int pos : selections ) { if ( pos != position ) { deselect ( pos ) ; } } } } item . withSetSelected ( ! selected ) ; view . setSelected ( ! selected ) ; if ( mSelectionListener != null ) mSelectionListener . onSelectionChanged ( item , ! selected ) ; if ( mPositionBasedStateManagement ) { if ( selected ) { if ( mSelections . contains ( position ) ) { mSelections . remove ( position ) ; } } else { mSelections . add ( position ) ; } } } }
handles the selection and deselects item if multiselect is disabled
