public boolean isEmpty() {
        return batchMetadata.isEmpty();
    }
This class represents the state of a specific producer-id.
It contains batchMetadata queue which is ordered such that the batch with the lowest sequence is at the head of the
queue while the batch with the highest sequence is at the tail of the queue. We will retain at most {@link ProducerStateEntry#NUM_BATCHES_TO_RETAIN}
elements in the queue. When the queue is at capacity, we remove the first element to make space for the incoming batch.
storage/src/main/java/org/apache/kafka/storage/internals/log/ProducerStateEntry.java