Skip to content

I'd Like a Two-argument Constructor for PageImpl #3296

Closed as not planned
Closed as not planned
@Attacktive

Description

@Attacktive

I'm sorry if it's already been discussed.

We currently have two options:

public PageImpl(List<T> content, Pageable pageable, long total) {
super(content, pageable);
this.total = pageable.toOptional().filter(it -> !content.isEmpty())//
.filter(it -> it.getOffset() + it.getPageSize() > total)//
.map(it -> it.getOffset() + content.size())//
.orElse(total);
}

public PageImpl(List<T> content) {
this(content, Pageable.unpaged(), CollectionUtils.isEmpty(content) ? 0 : content.size());
}

I think it's common to want a constructor with List<T> content and Pageable pageable:

public PageImpl(List<T> content, Pageable pageable) {
	this(content, pageable, CollectionUtils.isEmpty(content) ? 0 : content.size());
}

I just gave my two cents.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: declinedA suggestion or change that we don't feel we should currently apply

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions