Code example for HashSet

Methods: removeAll, size

    public int getNumberActiveDeviceMotionSensors() { 
        Set<Integer> deviceMotionSensors = new HashSet<Integer>(DEVICE_MOTION_SENSORS);
        return DEVICE_MOTION_SENSORS.size() - deviceMotionSensors.size();
     * Stop listening to sensors for a given event type. Ensures that sensors are not disabled 
     * if they are still in use by a different event type. 
     * @param eventType Type of event to listen to, can be either DEVICE_ORIENTATION or 
     *                  DEVICE_MOTION. 
     * We strictly guarantee that the corresponding native*() methods will not be called 
     * after this method returns. 
    public void stop(int eventType) {