Last active
December 18, 2018 20:40
-
-
Save randyhbh/7d4dc62d4e22e9db50afbc8049fc8c39 to your computer and use it in GitHub Desktop.
Find the amount of letter X inside the String Y
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
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