Created
February 15, 2017 10:02
-
-
Save sujeet100/4fbeafcec5d32047a09621f40926d040 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 | |
assert(books.find(_.name == "TDD") == Option(new Book("TDD", "Kent", 250))) | |
//Java 8 | |
assertThat(books.stream() | |
.filter(book -> book.getName().equals("TDD")) | |
.findFirst(), | |
is(Optional.of(new Book("TDD", "Kent", 250)))); | |
//Groovy | |
assert books.find { it.name == "TDD" } == new Book("TDD", "Kent", 250) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment