Counting characters

Report a typo

Given a list of characters.

List<Character> characters = 
        Arrays.asList('z', '1', 'e', 'Z', 'q', 'd', '8', 'E');

And here is code with a stream:

long count = characters.stream()
        .filter(Character::isLetter)
        .map(Character::toUpperCase)
        .filter(c -> c != 'E')
        .count();

The count is ...

Enter a number
___

Create a free account to access the full topic