Skip to content

Hardcoded

Hardcoded ObjectId generator with a deterministic input sequence.

Mostly useful as a fake when testing algorithms that must generate IDs.

Constructors

Hardcoded

constructor(ids: Iterator<ObjectId>)
constructor(ids: Iterable<ObjectId>)

Each call to newId will return the next ID in order of ids.

If newId is called once more than the number of IDs in ids, a NoSuchElementException will be thrown.

constructor(vararg ids: ObjectId)

Each call to newId will return the next ID in order of ids.

If newId is called once more than the number of IDs in ids, a NoSuchElementException will be thrown.

Functions

newId

open override fun newId(): ObjectId

Creates a new instance of an ObjectId.

Throws

NoSuchElementException

If the generator is not able to generate more IDs.