-
Notifications
You must be signed in to change notification settings - Fork 691
Closed as not planned
Labels
status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply
Description
I'm sorry if it's already been discussed.
We currently have two options:
spring-data-commons/src/main/java/org/springframework/data/domain/PageImpl.java
Lines 47 to 55 in 2760cb9
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); | |
} |
spring-data-commons/src/main/java/org/springframework/data/domain/PageImpl.java
Lines 63 to 65 in 2760cb9
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
Labels
status: declinedA suggestion or change that we don't feel we should currently applyA suggestion or change that we don't feel we should currently apply