If you want to filter the list of records retrieved from the database. you can do this using lambdas and StreamAPI. Something like:
list.stream()
.filter(entity -> "bar".equals(entity.getFoo()))
.collect(Collectors.toList());
In General, you need to filter in the query to the database.