Do not reuse node objects

This commit is contained in:
TheMode 2021-06-02 11:29:16 +02:00
parent 12c620df7a
commit bdfa164695

View File

@ -23,16 +23,14 @@ public class EventNode<T extends Event> {
this.type = type;
}
private static final EventNode<Event> EMPTY = new EventNode<>(Event.class);
public static EventNode<Event> create() {
return EMPTY;
}
public static <E extends Event> EventNode<E> create(@NotNull Class<E> type) {
return new EventNode<>(type);
}
public static EventNode<Event> create() {
return create(Event.class);
}
public static <E extends Event> EventNode<E> conditional(@NotNull Class<E> type,
@NotNull Predicate<E> predicate) {
return new EventNodeConditional<>(type, predicate);