public List<TravelDemand> getDemands(Predicate<TravelDemand> predicate) { return demands.stream().filter(predicate).collect(Collectors.toList()); }
public void mark(int id) { Optional<TravelDemand> optional = demands.stream().filter(d -> id == d.getIndex()).findFirst(); if (optional.isPresent()) { optional.get().setServe(true); } }
public Collection<TravelDemand> getDemands() { return demands.stream().filter(d -> !d.serve()).collect(Collectors.toList()); }