Page tree

Versions Compared

Key

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

...

  • 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
Code Block
languagejava
Optional<VirtualUriMapping.Result> mappingBestMatch = registry.getAllDefinitions().stream()
        .map(uriMapping -> uriMapping.mapUri(uri))
        .filter(Optional::isPresent)
        .map(Optional::get)
        .max(VirtualUriMapping.Result::compareTo);


Overrides

  • 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)

...