Reports java.util.Optional or com.google.common.base.Optional types with an array or collection type parameter.

In such cases, it is more clear to just use an empty array or collection to indicate the absence of result.

Example:


  Optional<List<Integer>> foo() {
    return Optional.empty();
  }

This code could look like:


  List<Integer> foo() {
    return new List<>();
  }