Code example for Set

Methods: contains, remove, size

0
    void unselect(long handle) {
        boolean wasSelected = isSelected(handle);
        if (!wasSelected) {
            return; 
        } 
        selection.remove(handle);
        if (getSelectionCount() == 0) { 
            finishActionMode(); 
            return; 
        } 
        owner.notifyDataSetChanged();
        onItemSelectedStateChanged(); 
    } 
 
    Set<Long> getSelection() {
        // Return a copy to prevent concurrent modification problems 
        return new HashSet<Long>(selection);
    } 
 
    int getSelectionCount() { 
        return selection.size();
    } 
 
    boolean isSelected(long handle) {
        return selection.contains(handle);
    } 
 
    void finishActionMode() { 
        if (actionMode != null) {
            actionMode.finish();