diff options
Diffstat (limited to 'mock/jrummikub/util/MockEvent2.java')
-rw-r--r-- | mock/jrummikub/util/MockEvent2.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mock/jrummikub/util/MockEvent2.java b/mock/jrummikub/util/MockEvent2.java index 93e8228..5aa7b59 100644 --- a/mock/jrummikub/util/MockEvent2.java +++ b/mock/jrummikub/util/MockEvent2.java @@ -6,8 +6,15 @@ public class MockEvent2<T1, T2> implements IEvent2<T1, T2> { public HashSet<IListener2<T1, T2>> listeners = new HashSet<IListener2<T1, T2>>(); @Override - public void add(IListener2<T1, T2> listener) { + public Connection add(final IListener2<T1, T2> listener) { listeners.add(listener); + return new Connection() { + + @Override + public void remove() { + MockEvent2.this.remove(listener); + } + }; } @Override |