本文整理汇总了Java中org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils.anyMatch方法的典型用法代码示例。如果您正苦于以下问题:Java IteratorUtils.anyMatch方法的具体用法?Java IteratorUtils.anyMatch怎么用?Java IteratorUtils.anyMatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils
的用法示例。
在下文中一共展示了IteratorUtils.anyMatch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hasStepOfAssignableClassRecursively
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; //导入方法依赖的package包/类
/**
* Determine if the traversal has any of the supplied steps of an assignable class in the current {@link Traversal}
* and its {@link Scope} child traversals.
*
* @param scope whether to check global or local children (null for both).
* @param stepClasses the step classes to look for
* @param traversal the traversal in which to look for the given step classes
* @return <code>true</code> if any step in the given traversal (and its child traversals) is an instance of a class
* provided in <code>stepClasses</code>, otherwise <code>false</code>.
*/
public static boolean hasStepOfAssignableClassRecursively(final Scope scope, final Collection<Class> stepClasses, final Traversal.Admin<?, ?> traversal) {
if (stepClasses.size() == 1)
return hasStepOfAssignableClassRecursively(stepClasses.iterator().next(), traversal);
for (final Step<?, ?> step : traversal.getSteps()) {
if (IteratorUtils.anyMatch(stepClasses.iterator(), stepClass -> stepClass.isAssignableFrom(step.getClass()))) {
return true;
}
if (step instanceof TraversalParent) {
if (null == scope || Scope.local.equals(scope)) {
for (final Traversal.Admin<?, ?> localChild : ((TraversalParent) step).getLocalChildren()) {
if (hasStepOfAssignableClassRecursively(stepClasses, localChild)) return true;
}
}
if (null == scope || Scope.global.equals(scope)) {
for (final Traversal.Admin<?, ?> globalChild : ((TraversalParent) step).getGlobalChildren()) {
if (hasStepOfAssignableClassRecursively(stepClasses, globalChild)) return true;
}
}
}
}
return false;
}