hrldcpr / pcollections

A Persistent Java Collections Library
Other
765 stars 79 forks source link

Add unit tests for nulls, plus some null checks #100

Closed prdoyle closed 2 years ago

prdoyle commented 2 years ago

Mostly fixes #54. I did not add checks for null values in maps. It's not clear to me that we should forbid this anyway.

Besides that, it turns out we were mostly already throwing NPE for nulls. The only missing ones were the IntTreePMap minus methods.

I also switched to using the built-in requireNonNull method instead of our own bespoke one, and added some additional null checks in all the constructors for good measure.

Dependency note

This PR is built on top of #99, because I wanted to test that PSet.intersect correctly detected nulls. I can rebase this one once that one is merged, if you want.

prdoyle commented 2 years ago

Superseded by #104