本文整理汇总了Java中org.apache.commons.collections4.IteratorUtils.transformedIterator方法的典型用法代码示例。如果您正苦于以下问题:Java IteratorUtils.transformedIterator方法的具体用法?Java IteratorUtils.transformedIterator怎么用?Java IteratorUtils.transformedIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.collections4.IteratorUtils
的用法示例。
在下文中一共展示了IteratorUtils.transformedIterator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createUniqueSetIterator
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
/**
* Creates a unique set iterator.
* Subclasses can override this to return iterators with different properties.
*
* @return the uniqueSet iterator
*/
protected Iterator<E> createUniqueSetIterator() {
final Transformer<Entry<E>, E> transformer = new Transformer<Entry<E>, E>() {
@Override
public E transform(Entry<E> entry) {
return entry.getElement();
}
};
return IteratorUtils.transformedIterator(entrySet().iterator(), transformer);
}
示例2: createEntrySetIterator
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
@Override
protected Iterator<MultiSet.Entry<K>> createEntrySetIterator() {
final MapEntryTransformer transformer = new MapEntryTransformer();
return IteratorUtils.transformedIterator(map.entrySet().iterator(), transformer);
}
示例3: getSatisfyingTuples
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
/**
* Returns the set of tuples that could satisfy conditions required by the given test case.
*/
private Iterator<Tuple> getSatisfyingTuples( final TestCaseDef testCase, VarTupleSet varTupleSet)
{
final Comparator<VarBindingDef> byUsage = byUsage( varTupleSet);
return
IteratorUtils.transformedIterator
( // Iterate over all combinations of bindings...
new CartesianProduct<VarBindingDef>
( // ...combining members from all sets...
new ArrayList<Set<VarBindingDef>>
( CollectionUtils.collect
( // ...where each set of bindings is derived from a disjunct of unsatisfied test case conditions....
testCase.getRequired().getDisjuncts(),
// ...and contains the set of compatible bindings that could satisfy this disjunct...
new Transformer<IDisjunct,Set<VarBindingDef>>()
{
public Set<VarBindingDef> transform( IDisjunct disjunct)
{
return
CollectionUtils.collect
( filtered
( getPropertyProviders
( CollectionUtils.collect
( disjunct.getAssertions(),
new Transformer<IAssertion,String>()
{
public String transform( IAssertion assertion)
{
return assertion.getProperty();
}
},
new HashSet<String>())),
testCase.getBindingCompatible()),
sameBinding_,
new TreeSet<VarBindingDef>( byUsage));
}
},
// For repeatable combinations, ensure set members have a well-defined order.
new TreeSet<Set<VarBindingDef>>( varBindingSetSorter_))),
// ...ignoring any infeasible combinations...
isFeasibleTuple_),
// ... forming each combination of satisfying bindings into a tuple...
new Transformer<List<VarBindingDef>,Tuple>()
{
public Tuple transform( List<VarBindingDef> bindings)
{
return Tuple.of( bindings);
}
});
}
示例4: iterator
import org.apache.commons.collections4.IteratorUtils; //导入方法依赖的package包/类
@Override
public Iterator<O> iterator() {
return IteratorUtils.transformedIterator(source.iterator(), transformer);
}