Skip to content

Instantly share code, notes, and snippets.

@sbeitzel
Created August 24, 2015 16:04
Show Gist options
  • Save sbeitzel/8013792bf8c3bf20fdcd to your computer and use it in GitHub Desktop.
Save sbeitzel/8013792bf8c3bf20fdcd to your computer and use it in GitHub Desktop.
Why do I have to write this code? ListDataEvent has the type. Why are there three different methods to call on the listener? The *listener* should unpack the event!
private void notifyListeners(ListDataEvent lde) {
synchronized (_listeners) {
for (ListDataListener ldl : _listeners) {
switch (lde.getType()) {
case ListDataEvent.CONTENTS_CHANGED:
ldl.contentsChanged(lde);
break;
case ListDataEvent.INTERVAL_ADDED:
ldl.intervalAdded(lde);
break;
case ListDataEvent.INTERVAL_REMOVED:
ldl.intervalRemoved(lde);
break;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment