本文整理汇总了Java中org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils.asList方法的典型用法代码示例。如果您正苦于以下问题:Java IteratorUtils.asList方法的具体用法?Java IteratorUtils.asList怎么用?Java IteratorUtils.asList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils
的用法示例。
在下文中一共展示了IteratorUtils.asList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: g_V_addVXanimalX_propertyXname_valuesXnameXX_propertyXname_an_animalX_propertyXvaluesXnameX_labelX
import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; //导入方法依赖的package包/类
@Test
@LoadGraphWith(MODERN)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_PROPERTY)
@FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_MULTI_PROPERTIES)
public void g_V_addVXanimalX_propertyXname_valuesXnameXX_propertyXname_an_animalX_propertyXvaluesXnameX_labelX() {
final Traversal<Vertex, Vertex> traversal = get_g_V_addVXanimalX_propertyXname_valuesXnameXX_propertyXname_an_animalX_propertyXvaluesXnameX_labelX();
printTraversalForm(traversal);
while (traversal.hasNext()) {
final Vertex vertex = traversal.next();
assertEquals("animal", vertex.label());
assertEquals(2, IteratorUtils.count(vertex.properties("name")));
List<String> names = IteratorUtils.asList(vertex.values("name"));
assertEquals(2, names.size());
assertTrue(names.contains("an animal"));
assertTrue(names.contains("marko") || names.contains("vadas") || names.contains("josh") || names.contains("lop") || names.contains("ripple") || names.contains("peter"));
if (names.contains("marko")) {
assertEquals("person", vertex.value("marko"));
} else if (names.contains("vadas")) {
assertEquals("person", vertex.value("vadas"));
} else if (names.contains("josh")) {
assertEquals("person", vertex.value("josh"));
} else if (names.contains("ripple")) {
assertEquals("software", vertex.value("ripple"));
} else if (names.contains("lop")) {
assertEquals("software", vertex.value("lop"));
} else if (names.contains("peter")) {
assertEquals("person", vertex.value("peter"));
} else {
throw new IllegalStateException("This state should not have been reached");
}
}
}