C#IList.Where()等效于Java?

时间:2015-10-19 00:17:21

标签: java c# list lambda

如何在Java中执行C#代码?

public IEnumerable<Cliente> FiltroPorLocalidad(IList<Cliente> clientes)
     {
         return clientes.Where(c => c.Saldo < 0);
     }

Java中有IList.Where()吗?

1 个答案:

答案 0 :(得分:3)

流api在这里类似:

myList.stream().filter(s -> s.Saldo < 0)
.collect(Collectors.toList());