Lambdas
Use lambda expressions and interfaces to increase modularity in your code.
Avoid catching all by value [=] or by reference [&] when declaring a lambda function. Try to list out every variable your lambda will need, and prefer to pass by reference as opposed to by value.
When using a function pointer, always put the & (dereference operator) to avoid any confusion.
BAD:
foo(frc5431::myLambda);GOOD:
foo(&frc5431::myLambda);When defining a functional interface, use the @FunctionalInterface annotation:
@FunctionalInterface
public interface Footerface {
public void doFoo();
}Last updated
Was this helpful?