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

MapStream methods #1788

Merged
merged 1 commit into from Sep 3, 2018
Merged

MapStream methods #1788

merged 1 commit into from Sep 3, 2018

Conversation

wjnicholson
Copy link
Contributor

  • Sorting by keys and by values
  • Maximum and minimum by keys and by values

* Sorting by keys and values
* Maximum and minimum by keys and values
* @param comparator a comparator of keys
* @return the minimum entry
*/
public Optional<Map.Entry<K, V>> minKeys(Comparator<? super K> comparator) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be called minKey (singular)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking it would be minKeys because you're taking the minimum by comparing the keys, whereas minKey makes me think that it will return the minimum key i.e Optional<K>

Happy to be wrong.

Copy link
Member

Choose a reason for hiding this comment

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

I think the name is fine as is, I just struggle to think that these four min/max methods would actually be used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I wanted to use them, that's why I thought of them.

* @param comparator a comparator of values
* @return the minimum entry
*/
public Optional<Map.Entry<K, V>> minValues(Comparator<? super V> comparator) {
Copy link
Contributor

Choose a reason for hiding this comment

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

minValue?

* @param comparator a comparator of keys
* @return the maximum entry
*/
public Optional<Map.Entry<K, V>> maxKeys(Comparator<? super K> comparator) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maxKey?

* @param comparator a comparator of values
* @return the maximum entry
*/
public Optional<Map.Entry<K, V>> maxValues(Comparator<? super V> comparator) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maxValue?

* @param comparator a comparator of keys
* @return the minimum entry
*/
public Optional<Map.Entry<K, V>> minKeys(Comparator<? super K> comparator) {
Copy link
Member

Choose a reason for hiding this comment

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

I think the name is fine as is, I just struggle to think that these four min/max methods would actually be used.

@wjnicholson wjnicholson merged commit 7a5734b into master Sep 3, 2018
@wjnicholson wjnicholson deleted the topic/MapStream-max-sorted branch September 3, 2018 08:54
@jodastephen jodastephen added this to the v2.1 milestone Oct 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants