Scala SortedMap的count()方法及示例
count()方法是用来计算SortedMap中的一对键的。
方法定义: def count(p: ((A, B)) => Boolean):Int
返回类型。它返回SortedMap中满足给定谓词的键的数量。
例子 #1:
输出。
例子#2。
输出。
因此,相同的钥匙只被计算一次。
count()方法是用来计算SortedMap中的一对键的。
方法定义: def count(p: ((A, B)) => Boolean):Int
返回类型。它返回SortedMap中满足给定谓词的键的数量。
例子 #1:
输出。
例子#2。
输出。
因此,相同的钥匙只被计算一次。