Code example for ArrayList

Methods: addcontains

0
	public boolean registerListener(SensorEventListener listener, Sensor sensor, int rate) {
		 
		if(forceListenersToFail)
			return false; 
		 
		if(!listeners.contains(listener))
			listeners.add(listener);
		 
		return true; 
	} 
	 
	@Implementation 
	public void unregisterListener(SensorEventListener listener, Sensor sensor) {
		listeners.remove(listener);
	} 
	 
	public boolean hasListener(SensorEventListener listener) {
		return listeners.contains(listener);
	} 
 
Contextual code suggestions in your IDE  Get Codota for Java