Skip to content

Conversation

@xirc
Copy link
Contributor

@xirc xirc commented Mar 19, 2021

Closes the issue #137 😄

Operators below against empty collection should throw UnsupportedOperationException.

  • reduce
  • min
  • max
  • minBy
  • maxBy

We can see scala.collection.iterator.reduce throws UnsupportedOperationException if the collection is empty.
scala.collection.iterator#reduce

Changes

  • Nil.par.reduce throws UnsupportedOperationException.
  • Nil.par.min throws UnsupportedOperationException.
  • Nil.par.max throws UnsupportedOperationException.
  • Add a test whether Nil.par.minBy throws UnsupportedOperationException.
  • Add a test whether Nil.par.maxBy throws UnsupportedOperationException.

@xirc xirc marked this pull request as ready for review March 19, 2021 13:21
Base automatically changed from master to main March 22, 2021 19:28
@SethTisue
Copy link
Member

review by @scala/collections crew and/or by @axel22 ?

Copy link

@johnynek johnynek left a comment

Choose a reason for hiding this comment

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

Looks correct to me. Looks properly tested.

@SethTisue SethTisue merged commit 7bc6f6e into scala:main Mar 23, 2021
@SethTisue
Copy link
Member

thank you @xirc, @johnynek, and @NthPortal!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants