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

Remove explicit null checks #2744

Open
wants to merge 25 commits into
base: version/1.x
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6445c85
[failing] Removed Objects.requireNonNull() checks throughout.
jbrains Apr 22, 2022
a62f55b
Shifted the failure from composing f.andThen(null) to invoking the re…
jbrains Apr 29, 2022
5c207d3
Removed an obsolete test.
jbrains Apr 29, 2022
8cd8fbb
Weakened an expected exception type, avoiding overspecifying.
jbrains Apr 29, 2022
d7525fe
Traversable can tolerate a null _combine_ operator when folding right…
jbrains Apr 29, 2022
d4e650f
Traversable can now tolerate a null Comparator if minBy() doesn't nee…
jbrains Apr 29, 2022
5f3fe30
Traversable now tolerates a null combine operator, as long as it does…
jbrains Apr 29, 2022
c093e16
Traversable now ignores the combine operator when trying to reduce() …
jbrains Apr 29, 2022
5fa7bf4
Traversables now ignore a null combine operator when reduce*() doesn'…
jbrains Apr 29, 2022
eae1d55
Fixed Traversable tests for reduce*Option(null) over an empty collect…
jbrains Apr 29, 2022
c76fdf7
Traversable.zip() now ignores a null argument when there's nothing to…
jbrains Apr 29, 2022
865ffea
Traversable can now tolerate a null Comparator if maxBy() doesn't nee…
jbrains Apr 30, 2022
fe0de3c
Traversable now ignores a null combine operator when it doesn't need …
jbrains Apr 30, 2022
3969840
Traversable now tolerates a null predicate when there are no elements…
jbrains Apr 30, 2022
a67ae71
Traversable now ignores a null partial function when it doesn't need …
jbrains Apr 30, 2022
95fcd33
iterator returns itself when empty
patrickguenther May 6, 2023
d4829d7
fixed CharSeqTest
patrickguenther May 6, 2023
819a84f
Stream::partition no longer throws when null predicate and empty
patrickguenther May 6, 2023
f36b463
Fixes EitherTest
patrickguenther May 6, 2023
9051824
fixed OptionTest
patrickguenther May 6, 2023
8c6732e
fixed TryTest
patrickguenther May 6, 2023
665a2c6
fixed ValidationTest
patrickguenther May 6, 2023
11f66ef
fixed JavaConvertersTest
patrickguenther May 6, 2023
1b6c25b
fixed FutureTest
patrickguenther May 6, 2023
28aa943
fixes erroneous javadoc comment
patrickguenther May 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/main/java/io/vavr/collection/Iterator.java
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,11 @@ public T next() {
// -- Additional methods of Iterator

@Override
@SuppressWarnings("unchecked")
default <R> Iterator<R> collect(PartialFunction<? super T, ? extends R> partialFunction) {
if (!hasNext()) {
Copy link
Author

@patrickguenther patrickguenther May 6, 2023

Choose a reason for hiding this comment

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

I'm not sure if this is adheres to coding guidelines.
If partialFunction == null should not throw when empty, this additional check is required, because the expression partialFunction::isDefinedAt will otherwise throw immediately.

return (Iterator<R>)this;
}
return filter(partialFunction::isDefinedAt).map(partialFunction);
}

Expand Down