All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.nemerosa.ontrack.model.support.Page.kt Maven / Gradle / Ivy

There is a newer version: 4.4.5
Show newest version
package net.nemerosa.ontrack.model.support

class Page
@JvmOverloads
constructor(
        var offset: Int = 0,
        var count: Int = 100
) {

    /**
     * Extracts a sublist using pagination information
     *
     * @param list Initial list
     * @param   Type of elements in the list
     * @return Sub list
     */
    fun  extract(list: List): List {
        val toIndex = Math.min(
                offset + count,
                list.size
        )
        return list.subList(
                offset,
                toIndex
        )
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy