private boolean canOptimiseForSingleAcknowledgeType(AcknowledgementBatch acknowledgementBatch) {
        if (acknowledgementBatch == null || acknowledgementBatch.acknowledgeTypes().size() == 1) return false;
        int firstAcknowledgeType = acknowledgementBatch.acknowledgeTypes().get(0);
        for (int i = 1; i < acknowledgementBatch.acknowledgeTypes().size(); i++) {
            if (acknowledgementBatch.acknowledgeTypes().get(i) != firstAcknowledgeType) return false;
        }
        return true;
    }
@return Returns true if the array of acknowledge types in the share fetch batch contains a single acknowledge type
and the array size can be reduced to 1.
Returns false when the array has more than one acknowledge type or is already optimised.
clients/src/main/java/org/apache/kafka/clients/consumer/internals/Acknowledgements.java