English | 简体中文

api-docs / org.ktorm.entity / elementAtOrNull

elementAtOrNull

fun <E : Any, T : BaseTable<E>> EntitySequence<E, T>.elementAtOrNull(
    index: Int
): E?
(source code)

Return an element at the given index or null if the index is out of bounds of this sequence.

Especially, if a dialect is enabled, this function will use the pagination feature to obtain the very record only.
Assuming we are using MySQL and calling this function with an index 10, a SQL containing limit 10, 1 will be
generated. But if there are no dialects enabled, then all records in the sequence will be obtained to ensure the
function just works.

The operation is terminal.