本文整理汇总了Java中org.apache.commons.collections4.IteratorUtils.filteredIterator方法的典型用法代码示例。如果您正苦于以下问题:Java IteratorUtils.filteredIterator方法的具体用法?Java IteratorUtils.filteredIterator怎么用?Java IteratorUtils.filteredIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.collections4.IteratorUtils
的用法示例。
在下文中一共展示了IteratorUtils.filteredIterator方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBaseValidCases
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
/**
* Returns a set of valid {@link TestCaseDef test case definitions} that extend the given base test cases.
*/
private List<TestCaseDef> getBaseValidCases( FunctionInputDef inputDef, VarTupleSet validTuples, List<TestCaseDef> baseCases)
{
logger_.debug( "{}: Extending valid base test cases", inputDef);
Iterator<TestCaseDef> validBaseCases =
IteratorUtils.filteredIterator
( baseCases.iterator(),
new Predicate<TestCaseDef>()
{
public boolean evaluate( TestCaseDef testCase)
{
return testCase.getInvalidVar() == null;
}
});
List<TestCaseDef> testCases = extendBaseCases( inputDef, validTuples, validBaseCases);
logger_.info( "{}: Extended {} valid base test cases", inputDef, testCases.size());
return testCases;
}
示例2: call
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
@Override
public Void call() throws GitAPIException {
checkCallable();
List<Ref> refs = gitRepository.getRefs(Ref.class);
List<Predicate<ReflogEntry>> refLogEntryFilterPredicates = new ArrayList<Predicate<ReflogEntry>>();
refLogEntryFilterPredicates.add(expireDatePredicate);
refLogEntryFilterPredicates.add(new ReflogEntryFilterPredicateAdapter(
reflogEntryFilter));
Predicate<ReflogEntry> refLogEntriesFilter = AllPredicate
.allPredicate(refLogEntryFilterPredicates);
try {
for (Ref ref : refs) {
List<ReflogEntry> reflogEntries = ref.getReflogEntries();
Iterator<ReflogEntry> reflogEntryIterator = reflogEntries
.iterator();
Iterator<ReflogEntry> filteredReflogEntryIterator = IteratorUtils
.filteredIterator(reflogEntryIterator,
refLogEntriesFilter);
List<ReflogEntry> nonFilteredReflogEntries = IteratorUtils
.toList(filteredReflogEntryIterator);
ref.clearReflog();
ref.addReflogEntries(nonFilteredReflogEntries);
}
} catch (IOException e) {
throw new GitAPIException("Unable to read reflog entries", e) {
private static final long serialVersionUID = 2266798959465371684L;
};
}
return null;
}
示例3: getBinds
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
/**
* Returns input tuples that bind the given variable.
*/
private Iterator<Tuple> getBinds( Iterator<Tuple> tuples, final VarDef var)
{
return
IteratorUtils.filteredIterator
( tuples,
new Predicate<Tuple>()
{
public boolean evaluate( Tuple tuple)
{
return tuple.getBinding( var) != null;
}
});
}
示例4: getVarBindings
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
/**
* Returns the bindings for variables of the given type for this function.
*/
public Iterator<VarBinding> getVarBindings( final String type)
{
return
IteratorUtils.filteredIterator
( varBindings_.iterator(),
new Predicate<VarBinding>()
{
@SuppressWarnings("deprecation")
public boolean evaluate( VarBinding binding)
{
return ObjectUtils.equals( binding.getType(), type);
}
});
}
示例5: getValidValues
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
/**
* Returns an iterator for the set of valid values.
*/
public Iterator<VarValueDef> getValidValues()
{
return
IteratorUtils.filteredIterator
( getValues(),
new Predicate<VarValueDef>()
{
public boolean evaluate( VarValueDef valueDef)
{
return valueDef.isValid();
}
});
}
示例6: getFailureValues
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
/**
* Returns an iterator for the set of failure values.
*/
public Iterator<VarValueDef> getFailureValues()
{
return
IteratorUtils.filteredIterator
( getValues(),
new Predicate<VarValueDef>()
{
public boolean evaluate( VarValueDef valueDef)
{
return !valueDef.isValid();
}
});
}
示例7: writeInputs
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
/**
* Writes the input value definitions for all variables of the given type.
*/
protected void writeInputs( TestCase testCase, String type)
{
Iterator<VarBinding> varBindings =
IteratorUtils.filteredIterator
( testCase.getVarBindings( type),
new Predicate<VarBinding>()
{
public boolean evaluate( VarBinding binding)
{
return !binding.isValueNA();
}
});
if( varBindings.hasNext())
{
xmlWriter_.writeTagStart( "DIV");
xmlWriter_.writeAttribute( "class", "input " + type);
xmlWriter_.writeTagEnd();
xmlWriter_.indent();
if( !IVarDef.ARG.equals( type))
{
xmlWriter_.writeElement( "H3", type);
}
writeVarSets( 0, varBindings);
xmlWriter_.unindent();
xmlWriter_.writeElementEnd( "DIV");
}
}
示例8: instances
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
@SuppressWarnings({ CompilerWarnings.UNCHECKED })
public static <T, U> FilterIterator<U> instances(Iterator<T> iterator, Class<U> clazz) {
return ((FilterIterator<U>) IteratorUtils.filteredIterator(iterator, PredicateUtils.instanceofPredicate(clazz)));
}