报告对空的集合、映射或数组的冗余操作。

对空集合进行的迭代、移除元素、排序和某些其他操作没有任何效果,可以移除。 此外,它们可能表明存在错误。

示例:

  if (numbers.isEmpty()){
    //由于缺少求反,因此错误
    int max = numbers.stream().max(Comparator.naturalOrder()).get();
    ...
  }

2019.1 的新功能