Package org.opencms.gwt.client.util
Class CmsListSplitter<T extends I_CmsHasSize>
- java.lang.Object
-
- org.opencms.gwt.client.util.CmsListSplitter<T>
-
- Type Parameters:
T
- the type of items in the list to be partitioned
public class CmsListSplitter<T extends I_CmsHasSize> extends java.lang.Object
A utility class for partitioning a list of items (each of which has a given size) into one or more batches of consecutive items such that each batch except the last one consists of just enough items to make the total sum of item sizes in the batch greater or equal than a given parameter.- Since:
- 8.0.0
-
-
Constructor Summary
Constructors Constructor Description CmsListSplitter(java.util.List<T> items, int batchSize)
Creates a new instance of a list splitter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<T>
getMore()
Gets the next batch of items.boolean
hasMore()
Returns true if there are more items left.
-
-
-
Constructor Detail
-
CmsListSplitter
public CmsListSplitter(java.util.List<T> items, int batchSize)
Creates a new instance of a list splitter.- Parameters:
items
- the list of items to splitbatchSize
- the minimum size of the batches (except for the last batch)
-
-