public boolean nonEmpty() {
        return numRecords() > 0;
    }
Check whether there has been at least one record appended to the batch.

@return true if one or more records have been appended
raft/src/main/java/org/apache/kafka/raft/internals/BatchBuilder.java