diff --git a/spring-kafka/src/main/java/org/springframework/kafka/config/KafkaListenerEndpointRegistry.java b/spring-kafka/src/main/java/org/springframework/kafka/config/KafkaListenerEndpointRegistry.java index da5e2692b9..46072b7277 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/config/KafkaListenerEndpointRegistry.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/config/KafkaListenerEndpointRegistry.java @@ -396,7 +396,7 @@ public void stop() { public void stop(Runnable callback) { this.running = false; Collection listenerContainersToStop = getListenerContainers(); - if (listenerContainersToStop.size() > 0) { + if (!listenerContainersToStop.isEmpty()) { AggregatingCallback aggregatingCallback = new AggregatingCallback(listenerContainersToStop.size(), callback); for (MessageListenerContainer listenerContainer : listenerContainersToStop) {