# Share iterator between users

**URL:** <https://community.gatling.io/t/share-iterator-between-users/2286>\
**Category:** Gatling (Open-Source)\
**Created:** [May 13, 2015, 12:10pm UTC](https://community.gatling.io/t/share-iterator-between-users/2286 "2015-05-13T12:10:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_Ben-Ami](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@Jonathan\_Ben-Ami](https://community.gatling.io/u/Jonathan_Ben-Ami)\
**Post date:** [May 13, 2015, 12:10pm UTC](https://community.gatling.io/t/share-iterator-between-users/2286/1 "2015-05-13T12:10:27Z")

</div>

Is there a way to share an iterator between gatling users (“threads”)?

What I’m seeing right now is that if I have something like:  
val it = Iterator.continually(Seq(1,2,3))

And I pull values from this iterator (e.g., it.next), each gatling user will start at 1 and circulate to 3, rather than the first user starting at 1, the second user at 2, etc., as would happen if I used a feed. How can I simulate the feed behavior without using a feed?

---

<div class="post-metadata">

**Author:** ![Alex\_R](https://avatars.discourse-cdn.com/v4/letter/a/ebca7d/32.png) [@Alex\_R](https://community.gatling.io/u/Alex_R)\
**Post date:** [May 14, 2015, 1:40am UTC](https://community.gatling.io/t/share-iterator-between-users/2286/2 "2015-05-14T01:40:49Z")

</div>

Hi Jonathan,

You can define your values in global feeder and loop thru these values in your scenario

val feeder = Iterator.continually(Map(“values”-\>List(1,2,3)))

val scn = scenario(“scn”).feed(feeder) {  
foreach("${values}", “value”) {

… your exec here using ${value} variable

}  
}
