Tidy up checkstyle violations
This commit is contained in:
parent
684cdc06ae
commit
1f986139bc
5 changed files with 8 additions and 6 deletions
|
@ -38,13 +38,14 @@ import java.util.stream.Stream;
|
|||
* @param <T> the type of the content
|
||||
* @author Paul Campbell (pcampbell@kemitix.net)
|
||||
*/
|
||||
@SuppressWarnings("methodcount")
|
||||
@RequiredArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
final class Just<T> implements Maybe<T> {
|
||||
|
||||
private final T value;
|
||||
|
||||
@Override
|
||||
public <R> Maybe<R> flatMap(Function<T, Maybe<R>> f) {
|
||||
public <R> Maybe<R> flatMap(final Function<T, Maybe<R>> f) {
|
||||
return f.apply(value);
|
||||
}
|
||||
|
||||
|
@ -55,7 +56,7 @@ final class Just<T> implements Maybe<T> {
|
|||
|
||||
@Override
|
||||
public boolean equals(final Object other) {
|
||||
return other instanceof Just && Objects.equals(this.value, ((Just) other).value);
|
||||
return other instanceof Just && Objects.equals(value, ((Just) other).value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,7 +71,7 @@ final class Just<T> implements Maybe<T> {
|
|||
|
||||
@Override
|
||||
public T orElse(final T otherValue) {
|
||||
return this.value;
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,7 +39,7 @@ final class Nothing<T> implements Maybe<T> {
|
|||
static final Maybe<?> INSTANCE = new Nothing<>();
|
||||
|
||||
@Override
|
||||
public <R> Maybe<R> flatMap(Function<T, Maybe<R>> f) {
|
||||
public <R> Maybe<R> flatMap(final Function<T, Maybe<R>> f) {
|
||||
return Maybe.nothing();
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ class Err<T> implements Result<T> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(final Object other) {
|
||||
return other instanceof Err && Objects.equals(error, ((Err) other).error);
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class Success<T> implements Result<T> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
public boolean equals(final Object other) {
|
||||
return other instanceof Success && Objects.equals(value, ((Success) other).value);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ public class ResultTest implements WithAssertions {
|
|||
assertThat(Result.ok(1)).isNotEqualTo(Result.error(runtimeException));
|
||||
assertThat(Result.error(runtimeException)).isEqualTo(Result.error(runtimeException));
|
||||
assertThat(Result.ok(1).equals("1")).isFalse();
|
||||
assertThat(Result.error(new RuntimeException()).equals("1")).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in a new issue