本文整理汇总了Java中org.apache.commons.collections4.IterableUtils.countMatches方法的典型用法代码示例。如果您正苦于以下问题:Java IterableUtils.countMatches方法的具体用法?Java IterableUtils.countMatches怎么用?Java IterableUtils.countMatches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.collections4.IterableUtils
的用法示例。
在下文中一共展示了IterableUtils.countMatches方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUnusedScore
import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
/**
* Returns a measure of the "unused-ness" of the given binding.
* Returns a value between 0 and 1 (exclusive) -- a higher value means a binding is more unused.
*/
public double getUnusedScore( final VarBindingDef binding)
{
// Returns the percentage of unused tuples that include this binding.
return
unused_.isEmpty()
? 0.0
: (double)
IterableUtils.countMatches
( unused_,
new Predicate<Tuple>()
{
public boolean evaluate( Tuple tuple)
{
return tuple.contains( binding);
}
})
/ unused_.size();
}
示例2: getTestCasesIncluding
import org.apache.commons.collections4.IterableUtils; //导入方法依赖的package包/类
/**
* Returns the number of test cases that include the given binding.
*/
private static int getTestCasesIncluding( FunctionTestDef testDef, final VarBinding binding)
{
return
(int)
IterableUtils.countMatches
( IteratorUtils.toList( testDef.getTestCases()),
new Predicate<TestCase>()
{
public boolean evaluate( TestCase testCase)
{
return testCaseIncludes( testCase, binding);
}
});
}