Skip to content

Instantly share code, notes, and snippets.

@sujeet100
Created February 15, 2017 10:02
Show Gist options
  • Save sujeet100/4fbeafcec5d32047a09621f40926d040 to your computer and use it in GitHub Desktop.
Save sujeet100/4fbeafcec5d32047a09621f40926d040 to your computer and use it in GitHub Desktop.
//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