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