Count of List string of single value pair

Viewed 33

I have a hash structure trail<String, List> where my key and value pair are more than one.

Now I want to get the count of list of single key value pair.

Am getting below result by calling method from another class. example:

myclass.mymethod returns below result.

{key1=[A, B, C, D, E], Key2=[01, 160, 50, 100, 30]}

Now I want the count of list with key1 key1=[A, B, C, D, E] as 5.

I tried below one but gives total count as 10.

int size = mapclass.mymethod.values().stream()
                     .mapToInt(Collection::size)
                     .sum();

Anyone having solution to my problem?

0 Answers
Related