Skip to content

Add support for getting a key set for ImmutableOpenMap #77897

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

Merged

Conversation

arteam
Copy link
Contributor

@arteam arteam commented Sep 16, 2021

Currently, we support only getting an iterator which is quite cumbersome to work with. Working with a set view is much better, because it bridges the iterator with Set.

#76921 added support for getting a stream on a map's values, we can provide a similar facility for keys and simplify a lot of client code that process the map's keys in an iterative way.

@arteam arteam force-pushed the add-support-for-keys-stream-on-immutable-open-map branch 2 times, most recently from f41f21b to 9d17328 Compare September 16, 2021 16:41
Currently, we support only getting an iterator which is quite cumbersome
to work with. The Streams API interacts much better with Java Collections.
@arteam arteam force-pushed the add-support-for-keys-stream-on-immutable-open-map branch from 9d17328 to 25c1b9e Compare September 16, 2021 16:42
@arteam arteam added :Core/Infra/Core Core issues without another label >non-issue labels Sep 20, 2021
@arteam arteam marked this pull request as ready for review September 22, 2021 07:55
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Sep 22, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@arteam arteam requested a review from rjernst September 22, 2021 11:45
@arteam arteam added the :Distributed Indexing/Distributed A catch all label for anything in the Distributed Indexing Area. Please avoid if you can. label Sep 23, 2021
@elasticmachine elasticmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label Sep 23, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

@arteam arteam added the v7.16.0 label Sep 23, 2021
@arteam
Copy link
Contributor Author

arteam commented Sep 23, 2021

@elasticmachine update branch

Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

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

Thanks Artem, I would like to see this done using keySet instead. Thanks for working on enhancing code readability.

@arteam arteam requested review from henningandersen and rjernst and removed request for henningandersen September 27, 2021 17:28
Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

Looking better!

Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

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

One more important detail otherwise looking good.

@arteam arteam added the auto-backport Automatically create backport pull requests when merged label Sep 29, 2021
@arteam arteam changed the title Add support for getting a Java stream over ImmutableOpenMap keys Add support for getting a key set for ImmutableOpenMap Sep 29, 2021
@arteam arteam merged commit 3714812 into elastic:master Sep 29, 2021
@arteam arteam deleted the add-support-for-keys-stream-on-immutable-open-map branch September 29, 2021 19:30
@arteam
Copy link
Contributor Author

arteam commented Sep 29, 2021

Thank you both!

@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
7.x Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 77897

arteam added a commit to arteam/elasticsearch that referenced this pull request Sep 29, 2021
arteam added a commit that referenced this pull request Oct 5, 2021
#76921 added support for getting entries as a Java stream, #77897 added the ability to get keys as a Set. This PR adds the values method which returns a Collection to bring the ImmutableOpenMap API closer to java.util.Map
arteam added a commit to arteam/elasticsearch that referenced this pull request Oct 5, 2021
elastic#76921 added support for getting entries as a Java stream, elastic#77897 added the ability to get keys as a Set. This PR adds the values method which returns a Collection to bring the ImmutableOpenMap API closer to java.util.Map

(cherry picked from commit cb73e3f)
arteam added a commit that referenced this pull request Oct 5, 2021
…78709)

#76921 added support for getting entries as a Java stream, #77897 added the ability to get keys as a Set. This PR adds the values method which returns a Collection to bring the ImmutableOpenMap API closer to java.util.Map

(cherry picked from commit cb73e3f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged :Core/Infra/Core Core issues without another label :Distributed Indexing/Distributed A catch all label for anything in the Distributed Indexing Area. Please avoid if you can. >non-issue Team:Core/Infra Meta label for core/infra team Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v7.16.0 v8.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants