Code example for HashSet

Methods: contains

0
        return listeners;
    } 
 
    boolean isListenerEnabled(ServiceInfo info) {
        final ComponentName cn = new ComponentName(info.packageName, info.name);
        return mEnabledListeners.contains(cn);
    } 
 
    @Override 
    public void onListItemClick(ListView l, View v, int position, long id) {
        ServiceInfo info = mList.getItem(position);
        final ComponentName cn = new ComponentName(info.packageName, info.name);
        if (mEnabledListeners.contains(cn)) {
            // the simple version: disabling 
            mEnabledListeners.remove(cn);
            saveEnabledListeners(); 
        } else { 
            // show a scary dialog 
            new ListenerWarningDialogFragment() 
                .setListenerInfo(cn, info.loadLabel(mPM).toString())
                .show(getFragmentManager(), "dialog");