Skip to content

Instantly share code, notes, and snippets.

@randyhbh
Last active December 18, 2018 20:40
Show Gist options
  • Save randyhbh/7d4dc62d4e22e9db50afbc8049fc8c39 to your computer and use it in GitHub Desktop.
Save randyhbh/7d4dc62d4e22e9db50afbc8049fc8c39 to your computer and use it in GitHub Desktop.
Find the amount of letter X inside the String Y
static int amountOfLetter(String chain, char letter) {
return chain.chars().mapToObj(i -> (char) i).filter(character -> character.equals(letter))
.collect(Collectors.toList()).size();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment