Value: clean up unneeded generics type parameters
This commit is contained in:
parent
ce42e9dcbe
commit
47d0b8f78d
1 changed files with 7 additions and 13 deletions
|
@ -26,11 +26,9 @@ import java.util.function.Supplier;
|
||||||
/**
|
/**
|
||||||
* A Value from an if-then-else in a functional-style.
|
* A Value from an if-then-else in a functional-style.
|
||||||
*
|
*
|
||||||
* @param <T> the type of the value
|
|
||||||
*
|
|
||||||
* @author Paul Campbell (pcampbell@kemitix.net).
|
* @author Paul Campbell (pcampbell@kemitix.net).
|
||||||
*/
|
*/
|
||||||
public interface Value<T> {
|
public interface Value {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link ValueClause} for the clause.
|
* Create a new {@link ValueClause} for the clause.
|
||||||
|
@ -144,12 +142,12 @@ public interface Value<T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ValueSupplier<T> then(final Supplier<T> trueSupplier) {
|
public ValueSupplier<T> then(final Supplier<T> trueSupplier) {
|
||||||
return new TrueValueSupplier<T>(trueSupplier);
|
return new TrueValueSupplier(trueSupplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ValueClause<T> and(final boolean clause) {
|
public ValueClause<T> and(final boolean clause) {
|
||||||
return Value.<T>where(clause);
|
return Value.where(clause);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -159,10 +157,8 @@ public interface Value<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An intermediate result of the {@link Value} where the clause has evaluated to true.
|
* An intermediate result of the {@link Value} where the clause has evaluated to true.
|
||||||
*
|
|
||||||
* @param <T> the type of the value
|
|
||||||
*/
|
*/
|
||||||
private class TrueValueSupplier<T> implements ValueSupplier<T> {
|
private class TrueValueSupplier implements ValueSupplier<T> {
|
||||||
|
|
||||||
private final Supplier<T> valueSupplier;
|
private final Supplier<T> valueSupplier;
|
||||||
|
|
||||||
|
@ -188,7 +184,7 @@ public interface Value<T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ValueSupplier<T> then(final Supplier<T> trueSupplier) {
|
public ValueSupplier<T> then(final Supplier<T> trueSupplier) {
|
||||||
return new FalseValueSupplier<T>();
|
return new FalseValueSupplier();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -198,15 +194,13 @@ public interface Value<T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ValueClause<T> or(final boolean clause) {
|
public ValueClause<T> or(final boolean clause) {
|
||||||
return Value.<T>where(clause);
|
return Value.where(clause);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An intermediate result of the {@link Value} where the clause has evaluated to false.
|
* An intermediate result of the {@link Value} where the clause has evaluated to false.
|
||||||
*
|
|
||||||
* @param <T> the type of the value
|
|
||||||
*/
|
*/
|
||||||
private class FalseValueSupplier<T> implements ValueSupplier<T> {
|
private class FalseValueSupplier implements ValueSupplier<T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T otherwise(final Supplier<T> falseSupplier) {
|
public T otherwise(final Supplier<T> falseSupplier) {
|
||||||
|
|
Loading…
Reference in a new issue