
pl.chilldev.commons.collections.pageable.PageableCollection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-collections Show documentation
Show all versions of commons-collections Show documentation
Collections-related utilities and data structures.
The newest version!
/**
* This file is part of the ChillDev-Commons.
*
* @license http://mit-license.org/ The MIT license
* @copyright 2015 - 2016 © by Rafał Wrzeszcz - Wrzasq.pl.
*/
package pl.chilldev.commons.collections.pageable;
import java.util.Iterator;
import java.util.function.Function;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Slice;
/**
* Collection class representing paged resource.
*
* @param Collection element type.
*/
public class PageableCollection implements Iterable
{
/**
* Initial page request.
*/
private Pageable request;
/**
* Data source for paged results.
*/
private Function> source;
/**
* Initializes collection for given starting point.
*
* @param request Initial page request.
* @param source Paged results data source.
*/
public PageableCollection(Pageable request, Function> source)
{
this.request = request;
this.source = source;
}
/**
* {@inheritDoc}
*/
@Override
public Iterator iterator()
{
return new PageableIterator<>(this.source.apply(this.request), this.source);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy