dont create a TreeMap if the underlying tree is unchanged#8738
Merged
retronym merged 1 commit intoscala:2.12.xfrom Feb 26, 2020
Merged
dont create a TreeMap if the underlying tree is unchanged#8738retronym merged 1 commit intoscala:2.12.xfrom
retronym merged 1 commit intoscala:2.12.xfrom
Conversation
0f179e0 to
b1efbd8
Compare
b1efbd8 to
574758d
Compare
szeiger
reviewed
Feb 26, 2020
| /** A factory to create empty maps of the same type of keys. | ||
| */ | ||
| override def empty: TreeMap[A, B] = TreeMap.empty[A, B](ordering) | ||
| override def empty: TreeMap[A, B] = newMap(null) |
Contributor
There was a problem hiding this comment.
same as in TreeSet: why create a new instance?
Member
There was a problem hiding this comment.
Echoing @mkeskells answer: TreeMap.empty isn't a singleton, it creates a new TreeMap instance with the implicitly supplied Ordering.
retronym
approved these changes
Feb 26, 2020
hamzaremmal
pushed a commit
to hamzaremmal/scala3
that referenced
this pull request
May 2, 2025
dont create a TreeMap if the underlying tree is unchanged
hamzaremmal
pushed a commit
to scala/scala3
that referenced
this pull request
May 7, 2025
dont create a TreeMap if the underlying tree is unchanged
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.
No description provided.