This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
JRummikub/test/jrummikub/util/MockEvent1.java

24 lines
463 B
Java
Raw Normal View History

package jrummikub.util;
import java.util.HashSet;
public class MockEvent1<T> implements IEvent1<T> {
public HashSet<IListener1<T>> listeners = new HashSet<IListener1<T>>();
@Override
public void add(IListener1<T> listener) {
listeners.add(listener);
}
@Override
public void remove(IListener1<T> listener) {
listeners.remove(listener);
}
public void emit(T value) {
for (IListener1<T> listener : listeners) {
listener.handle(value);
}
}
}