Created
November 7, 2015 05:18
-
-
Save hussachai/80b51a117e4ba5205a29 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
//Scala - strict collection | |
pets.filter { pet => pet.getBirthdate.isBefore(LocalDate.of(2013, Month.JANUARY, 1))} | |
.filter { pet => pet.getWeight > 50 } //List[Pet] | |
//Scala - non-strict collection | |
pets.views.filter { pet => pet.getBirthdate.isBefore(LocalDate.of(2013, Month.JANUARY, 1))} | |
.filter { pet => pet.getWeight > 50 } //SeqView[Pet] | |
//Scala - stream | |
pets.toStream.filter { pet => pet.getBirthdate.isBefore(LocalDate.of(2013, Month.JANUARY, 1))} | |
.filter { pet => pet.getWeight > 50 } //Stream[Pet] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment