AT
Join ServerApache TinkerPop
questions
get() on a List
Sspmallette1/17/2023
In Gremlin how does one do a
get()
on a List
in order to access an item by index?Solution
Sspmallette1/17/2023
Gremlin doesn't have
get()
but you can accomplish similar things with the range()
, limit()
, tail()
, and skip()
:gremlin> g.inject([10,20,30,40,50]).limit(local,1)
==>10
gremlin> g.inject([10,20,30,40,50]).tail(local,1)
==>50
gremlin> g.inject([10,20,30,40,50]).range(local,2,3)
==>30