Merged
Conversation
This commit introduces a method that simplifies creating a map deep copy
Collaborator
|
Pinging @elastic/es-distributed (Team:Distributed) |
original-brownbear
approved these changes
Jul 11, 2022
Contributor
original-brownbear
left a comment
There was a problem hiding this comment.
LGTM but maybe rename including a "deep" in the name of the new method.
| /** | ||
| * This method creates a copy of the {@code source} map using {@code copyValueFunction} to create a defensive copy of each value. | ||
| */ | ||
| public static <K, V> Map<K, V> copyOf(Map<K, V> source, Function<V, V> copyValueFunction) { |
Contributor
There was a problem hiding this comment.
Maybe better call if deepCopy to make it clearer from the name what this is for?
Contributor
Author
There was a problem hiding this comment.
I would keep it consistent with java.util.Map#copyOf especially as it could also be used for stream>map>collect type of operations as well
Contributor
There was a problem hiding this comment.
That was kinda my point actually. I'd rather not have the same name as the JDK method here since this does something quite different :) But either way, this was more of a NIT, go with it if you disagree, it was more of a NIT :)
weizijun
added a commit
to weizijun/elasticsearch
that referenced
this pull request
Jul 13, 2022
* upstream/master: (38 commits) Simplify map copying (elastic#88432) Make DiffableUtils.diff implementation agnostic (elastic#88403) Ingest: Start separating Metadata from IngestSourceAndMetadata (elastic#88401) Move runtime fields base scripts out of scripting fields api package. (elastic#88488) Enable TRACE Logging for test and increase timeout (elastic#88477) Mute ReactiveStorageIT#testScaleDuringSplitOrClone (elastic#88480) Track the count of failed invocations since last successful policy snapshot (elastic#88398) Avoid noisy exceptions on data nodes when aborting snapshots (elastic#88476) Fix ReactiveStorageDeciderServiceTests testNodeSizeForDataBelowLowWatermark (elastic#88452) INFO logging of snapshot restore and completion (elastic#88257) unmute test (elastic#88454) Updatable API keys - noop check (elastic#88346) Corrected an incomplete sentence. (elastic#86542) Use consistent shard map type in IndexService (elastic#88465) Stop registering TestGeoShapeFieldMapperPlugin in ESIntegTestCase (elastic#88460) TSDB: RollupShardIndexer logging improvements (elastic#88416) Audit API key ID when create or grant API keys (elastic#88456) Bound random negative size test in SearchSourceBuilderTests#testNegativeSizeErrors (elastic#88457) Updatable API keys - logging audit trail event (elastic#88276) Polish reworked LoggedExec task (elastic#88424) ... # Conflicts: # x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/v2/RollupShardIndexer.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit introduces a method that simplifies creating a map deep copy