Last active
September 1, 2016 10:04
-
-
Save hector6872/75b6925977ac0c011286 to your computer and use it in GitHub Desktop.
ManageListeners template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void addListener(Listener listener) { | |
if (listeners == null) { | |
listeners = new ArrayList<>(); | |
} | |
listeners.add(listener); | |
} | |
public void removeListener(Listener listener) { | |
if (listeners != null) { | |
int position = listeners.indexOf(listener); | |
if (position != -1) { | |
listeners.remove(position); | |
} | |
} | |
} | |
public void clearListener() { | |
if (listeners != null) { | |
listeners.clear(); | |
listeners = null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment