Last active
November 15, 2015 06:01
-
-
Save hussachai/4edf0e130ce1f0e040a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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