Skip to content

Commit

Permalink
Suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
rickie committed Aug 31, 2023
1 parent b6d33e6 commit f88cf68
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Function<Optional<T>, T> after() {
}

/** Prefer {@link Optional#equals(Object)} over more contrived alternatives. */
static final class OptionalHasValue<T, S> {
static final class OptionalEqualsOptional<T, S> {
@BeforeTemplate
boolean before(Optional<T> optional, S value) {
return Refaster.anyOf(
Expand Down Expand Up @@ -454,5 +454,5 @@ Stream<T> after(Optional<T> optional) {

// XXX: Add a rule for:
// `optional.flatMap(x -> pred(x) ? Optional.empty() : Optional.of(x))` and variants.
// (Maybe canonicalize the inner expression. Maybe we rewrite already.)
// (Maybe canonicalize the inner expression. Maybe we rewrite it already.)
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Function<Optional<Integer>, Integer> testOptionalOrElseThrowMethodReference() {
return Optional::get;
}

ImmutableSet<Boolean> testOptionalHasValue() {
ImmutableSet<Boolean> testOptionalEqualsOptional() {
return ImmutableSet.of(
Optional.of("foo").filter("bar"::equals).isPresent(),
Optional.of("baz").stream().anyMatch("qux"::equals));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Function<Optional<Integer>, Integer> testOptionalOrElseThrowMethodReference() {
return Optional::orElseThrow;
}

ImmutableSet<Boolean> testOptionalHasValue() {
ImmutableSet<Boolean> testOptionalEqualsOptional() {
return ImmutableSet.of(
Optional.of("foo").equals(Optional.of("bar")),
Optional.of("baz").equals(Optional.of("qux")));
Expand Down

0 comments on commit f88cf68

Please sign in to comment.