Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

...

Code Block
public JobSupervisor(Provider<JobDAO> jobDaoProvider, Provider<Long> jobTimeoutProvider) {

The Provider<X> interface provides a get() method returning X.  This allows for lazy initialization and/or providing an unknown number of X'es.

Further reading:

...

The general rule is "put declarations only at the beginning of blocks". We allow one exception from this rule, namely declarations that 1) initialize the variable and 2) depend on previous calculations are allowed be further down the block. Example:

Code Block
void Foo() {
    int i1 = 42;
    int i2 = 0;
    i2 = f(i1);
    int i3 = g(i2);
}

Miscellaneous

...