public class IdBatch extends Object implements Iterable<Long>
FlakeIdGenerator.
IDs can be iterated using a foreach loop:
IdBatch idBatch = myFlakeIdGenerator.newIdBatch(100);
for (Long id : idBatch) {
// ... use the id
}
Object is immutable.
| Constructor and Description |
|---|
IdBatch(long base,
long increment,
int batchSize)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
long |
base()
Returns the first ID in the set.
|
int |
batchSize()
Returns number of IDs in the set.
|
long |
increment()
Returns increment from
base() for the next ID in the set. |
Iterator<Long> |
iterator()
Returns iterator that will iterate contained IDs (boxing the as
Long). |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic IdBatch(long base,
long increment,
int batchSize)
base - See base()increment - See increment()batchSize - See batchSize()public long base()
public long increment()
base() for the next ID in the set.public int batchSize()
Copyright © 2019 Hazelcast, Inc.. All Rights Reserved.