【发布时间】:2020-07-15 03:03:32
【问题描述】:
尝试使用 Stream.filter 获取子列表过滤器时出现此异常:
List<Presupuesto> PresupuestosTienda = presupuestos.stream().filter(item -> item.tienda.equals(LaTienda.nombre)).collect(Collectors.toList());
- “presupuestos”也是
List<Presupuesto>。
我的课Presupuesto很简单:
public class Presupuesto {
String vendedor, tienda;
Date fecha;
double total;
public Presupuesto(){
}
public Presupuesto(String vendedor, String tienda, Date fecha, double total){
this.vendedor=vendedor;
this.tienda=tienda;
this.fecha=fecha;
this.total=total;
}
}
我真的不知道为什么会这样。我从互联网上举了一个例子,它有效!差别不大。
有人知道会发生什么吗?非常感谢
【问题讨论】:
-
变量
presupuestos是什么类型的? -
嗨 Nosrep,它也是一个 List
。
标签: java list filter java-stream