Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Cursor.elements() #496

Merged
merged 1 commit into from
Feb 28, 2024
Merged

Conversation

gavinking
Copy link
Contributor

Currently, PageRequest.Cursor is not even Iterable, which means that any time you want to read its elements you have to use an archaic indexed for loop. If you want to actually pass the key values as a list, you have to repackage them manually.

This adds an elements() method which automatically packages the elements as an unmodifiable list.

eliminates the need to write indexed 'for' loops
@gavinking gavinking marked this pull request as ready for review February 28, 2024 08:21
Copy link
Contributor

@otaviojava otaviojava left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it.
IMHO: the getKeysetElement is a candidate for removing as well.

@otaviojava otaviojava requested a review from njr-11 February 28, 2024 10:52
@gavinking
Copy link
Contributor Author

IMHO: the getKeysetElement is a candidate for removing as well.

Yeah, I agree. Even f only because the name is a mouthful :)

@otaviojava otaviojava merged commit 6a48c9b into jakartaee:main Feb 28, 2024
3 checks passed
@gavinking
Copy link
Contributor Author

Thanks folks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants