sashapolo commented on code in PR #3140:
URL: https://github.com/apache/ignite-3/pull/3140#discussion_r1474575884
##########
modules/core/src/main/java/org/apache/ignite/internal/event/AbstractEventProducer.java:
##########
@@ -39,30 +41,24 @@ public abstract class AbstractEventProducer<T extends
Event, P extends EventPara
@Override
public void listen(T evt, EventListener<? extends P> listener) {
listenersByEvent.compute(evt, (evt0, listeners) -> {
- List<EventListener<P>> newListeners;
-
- if (listeners == null) {
- newListeners = new ArrayList<>(1);
- } else {
- newListeners = new ArrayList<>(listeners.size() + 1);
-
- newListeners.addAll(listeners);
+ if (nullOrEmpty(listeners)) {
Review Comment:
I suggest to never have empty lists in this map, so we can also dump the
`isEmpty` check here
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]