Skip to content

Instantly share code, notes, and snippets.

@h-hub
Created September 17, 2023 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h-hub/8a7e9fc456b857ae59502509d94da205 to your computer and use it in GitHub Desktop.
Save h-hub/8a7e9fc456b857ae59502509d94da205 to your computer and use it in GitHub Desktop.
static void clientCode2() {
Item user = findItem2("99").get();
}
static Optional<Item> findItem2(String id) {
return Arrays.stream(users)
.filter(item -> item.id.equals(id))
.findFirst();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment