What is the difference between next() and iterate() when working with gremlin? Why does next() return the added vertex when calling g.addV(), but iterate() does not? When should I use next() and when should I use iterate()?
The answer is already in your question. You'll use .next(), when you need the result (and you are expecting exactly one result), and you'll use .iterate(), when you don't need the result (typically mutation queries, that add/change properties, edges and/or vertices).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With