Use isEmpty() to check whether the collection is empty or not
Sonar Link:
https://sonar.onap.org/project/issues?assignees=surendraReddy&id=org.onap.dmaap.messagerouter.msgrtr%3Amsgrtr&open=AWU41WkrwGn37JfbyH0h&resolved=false&severities=MAJOR
Location:
src/main/java/org/onap/dmaap/dmf/mr/backends/kafka/Kafka011Consumer.java
Line No-L116 L80
Change-Id: I8ece30c1fd0a0ff22ce50545befe32bcb5a733fc
Issue-ID: DMAAP-957
Signed-off-by: Surendra Reddy Katam <SK00524980@techmahindra.com>
fId = id;
fCreateTimeMs = System.currentTimeMillis();
fLastTouch = fCreateTimeMs;
- fPendingMsgs = new LinkedBlockingQueue<ConsumerRecord<String, String>>();
+ fPendingMsgs = new LinkedBlockingQueue<>();
fLogTag = fGroup + "(" + fId + ")/" + fTopic;
offset = 0;
state = Kafka011Consumer.State.OPENED;
public synchronized Consumer.Message nextMessage() {
try {
- if (fPendingMsgs.size() > 0) {
+ if (fPendingMsgs.isEmpty()) {
return makeMessage(fPendingMsgs.take());
}
} catch (InterruptedException x) {