Made variables final where possible
This commit is contained in:
parent
f950f55ed3
commit
fe703a9d50
3 changed files with 6 additions and 6 deletions
|
@ -17,7 +17,7 @@ public interface CommandResult {
|
|||
* with.
|
||||
* @return The combined result
|
||||
*/
|
||||
default Object combine(Object other) {
|
||||
default Object combine(final Object other) {
|
||||
return ListCommandResult.from(this, other);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public interface CommandResult {
|
|||
* @param target the object which the source will be combined into
|
||||
* @param source the object to combine into the target
|
||||
*/
|
||||
static Object combine(Object target, Object source) {
|
||||
static Object combine(final Object target, final Object source) {
|
||||
if (target instanceof CommandResult) {
|
||||
return ((CommandResult)target).combine(source);
|
||||
} else if (source instanceof EmptyCommandResult) {
|
||||
|
|
|
@ -13,7 +13,7 @@ public class EmptyCommandResult implements CommandResult {
|
|||
* the empty result.
|
||||
*/
|
||||
@Override
|
||||
public Object combine(Object other) {
|
||||
public Object combine(final Object other) {
|
||||
return other;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,14 +7,14 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class ListCommandResult implements CommandResult {
|
||||
private List<Object> results = new ArrayList<>();
|
||||
private final List<Object> results = new ArrayList<>();
|
||||
|
||||
public List<Object> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListCommandResult combine(Object other) {
|
||||
public ListCommandResult combine(final Object other) {
|
||||
if (!(other instanceof EmptyCommandResult)) {
|
||||
results.add(other);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ public class ListCommandResult implements CommandResult {
|
|||
return this;
|
||||
}
|
||||
|
||||
public static ListCommandResult from(Object a, Object b) {
|
||||
public static ListCommandResult from(final Object a, final Object b) {
|
||||
ListCommandResult list = new ListCommandResult();
|
||||
list = list.combine(a);
|
||||
list = list.combine(b);
|
||||
|
|
Loading…
Reference in a new issue