org.apache.tinkerpop.gremlin.ogm.paths.steps.FlatMap.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-gremlin-ogm Show documentation
Show all versions of kotlin-gremlin-ogm Show documentation
The Object Graph Mapping Library for Kotlin and Gremlin
package org.apache.tinkerpop.gremlin.ogm.paths.steps
import org.apache.tinkerpop.gremlin.ogm.paths.Path
/**
* A step that maps the current object to zero or more new objects.
*/
class FlatMap(private val map: (FROM) -> Iterable) : Step.ToMany({
it.traversal.flatMap { map(it.get()).iterator() }
})
fun Path.ToMany.flatMap(map: (TO) -> Iterable): Path.ToMany = to(FlatMap(map))
fun Path.ToOptional.flatMap(map: (TO) -> Iterable): Path.ToMany = to(FlatMap(map))
fun Path.ToSingle.flatMap(map: (TO) -> Iterable): Path.ToMany = to(FlatMap(map))
© 2015 - 2024 Weber Informatics LLC | Privacy Policy