Thursday, July 10, 2008

Java Final Arguments

When should I declare method parameters as final?
  • This prevents the parameter from being reassigned but does not make it immutable
  • It is mandatory to make the parameter available to anonymous inner classes
 UnaryOperator bind ( final BinaryOperator binOp, final Object boundLeftArg) {
return new UnaryOperator() {
public Object apply(Object arg) {
return binOp.apply(boundleftArg, arg);

No comments: