
uk.co.mruoc.promo.repository.account.mysql.BatchBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of burger-promo Show documentation
Show all versions of burger-promo Show documentation
Burger promotion backend apis
The newest version!
package uk.co.mruoc.promo.repository.account.mysql;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.ListUtils;
import uk.co.mruoc.promo.entity.account.Account;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@RequiredArgsConstructor
public class BatchBuilder {
private static final int DEFAULT_BATCH_SIZE = 1000;
private final int batchSize;
public BatchBuilder() {
this(DEFAULT_BATCH_SIZE);
}
public List> toBatches(Collection accounts) {
return ListUtils.partition(new ArrayList<>(accounts), batchSize);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy