Skip to content

Instantly share code, notes, and snippets.

@hussachai
Last active November 15, 2015 06:01
Show Gist options
  • Save hussachai/4edf0e130ce1f0e040a2 to your computer and use it in GitHub Desktop.
Save hussachai/4edf0e130ce1f0e040a2 to your computer and use it in GitHub Desktop.
//Java 8 - Collection
pets.removeIf(pet -> !(pet.getBirthdate().isBefore(LocalDate.of(2013, Month.JANUARY, 1))
&& pet.getWeight() > 50));
//Applying De-Morgan's law.
pets.removeIf(pet -> pets.get(0).getBirthdate().toEpochDay() >= LocalDate.of(2013, Month.JANUARY, 1).toEpochDay()
|| pet.getWeight() <= 50);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment