Browse Source

Ensure contract of Collections#synchronizedList

Looping over a synchronized list must either manually synchronize over the list or use the "atomic" List#forEach method.
modulesv2
weisj 3 years ago
parent
commit
58bc2055e3
No known key found for this signature in database
GPG Key ID: 31124CB75461DA2A
  1. 8
      theme/src/main/java/com/github/weisj/darklaf/theme/event/ThemeEventSupport.java

8
theme/src/main/java/com/github/weisj/darklaf/theme/event/ThemeEventSupport.java

@ -43,10 +43,8 @@ public class ThemeEventSupport<E extends ThemeEvent, T extends ThemeEventListene
} }
public void dispatchEvent(final E event, final BiConsumer<T, E> consumer) { public void dispatchEvent(final E event, final BiConsumer<T, E> consumer) {
for (T listener : listenerList) { listenerList.forEach(listener -> {
if (listener != null) { if (listener != null) consumer.accept(listener, event);
consumer.accept(listener, event); });
}
}
} }
} }

Loading…
Cancel
Save