Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add primitive section for functional-style idioms


  • Single-line if-statements: we always use curly braces
  • Unnecessary else-branch: if the else is not necessary (e.g. because if-branch always returns or throws an exception) we omit it

Functional-style idioms

  • Streams/Optionals are formatted one operation per line, after the .stream() initiator;
    • actually can be considered a general recommendation for fluent APIs
    • static imports for Collectors is highly encouraged
  • Streams are generally preferred to Guava transforms
  • Optional is a good return type, not an argument type


  • for optimal refactoring support we use the @Override for all methods that override methods declared in superclasses/implemented interfaces
    • Hint: you might want to adapt compiler settings of your IDE to show Errors on missing @Override's (Eclipse and Idea provide that option)