Allow passing Entry subclasses to Map factory methods #51
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.
Change the factory methods to accept a covariant type (e.g., Iterable<? extends Map.Entry>), which allows passing Iterables of UnEntry.
Note: perhaps I'm just using the library wrong, but I ran into this issue when I was attempting to merge two maps. It seemed to me that I should be able to do this:
While I know it's doable like so, to me it seems like an unnecessary limitation, and this form is more verbose:
(Would be happy to be shown a better way to merge two maps).
Another consequence of making it covariant is that you can now pass a Persistent map instance to the factory method.