X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Futils%2FPagination.kt;fp=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Futils%2FPagination.kt;h=130fe2e82c2bc9038ccc9124764822eb5f193e78;hp=0000000000000000000000000000000000000000;hb=ac6576e72155b3691ce6e5c56ee0c57eb9ac08c6;hpb=cc13ef909d3b9e265918e396466c320ce63235ae diff --git a/src/main/kotlin/net/pterodactylus/sone/utils/Pagination.kt b/src/main/kotlin/net/pterodactylus/sone/utils/Pagination.kt new file mode 100644 index 0000000..130fe2e --- /dev/null +++ b/src/main/kotlin/net/pterodactylus/sone/utils/Pagination.kt @@ -0,0 +1,42 @@ +package net.pterodactylus.sone.utils + +/** + * Helper class for lists that need pagination. Setting the page or the page + * size will automatically recalculate all other parameters, and the next call + * to [Pagination.items] retrieves all items on the current page. + *
+ * A pagination object can be used as an [Iterable]. When the [Iterator]
+ * from [Pagination.iterator] is requested, the iterator over
+ * [Pagination.items] is returned.
+ *
+ * @param