记录Bigdecimal中参数和BigDecimal zero比较失效的异常
List<StockBatchDTO> b = a.stream().filter(v->!v.getQuantity().equals(BigDecimal.ZERO)).collect(Collectors.toList());//失效
List<StockBatchDTO> c = a.stream().filter(v->v.getQuantity().compareTo(BigDecimal.ZERO) !=0).collect(Collectors.toList());
原因分析:
![在这里插入图片描述](https://img-blog.csdnimg.cn/cdd85891473042368e6c862a7f601869.png)
equal带有精度比较