title: Iterate over collection in Frida - Creating an iterator
body: <p>I'm hooking a Java method in Frida which looks like</p>
  
  <pre><code>public ABC setSomething(Collection&lt;RandObject&gt; things) {
    this.things = new ArrayList(things);
    return this;
  }
  </code></pre>
  
  <p>In javascript, I'm able to log the <code>things</code> parameter and it prints out the RandObjects. I'm also able to do a <code>size()</code> and get the total number of elements inside.</p>
  
  <p>Anything I do to try to iterate over the collection doesn't work. You can't access elements with <code>.get(X)</code> or <code>[X]</code>. I can't do an <code>Array.from</code> since Frida doesn't seem to have that available. I believe I need to create an iterator to properly do this. How can I do that?</p>
  
  <p>I was messing around with trying to instantiate <code>Java.use("java.util.Iterator")</code> but am stuck.</p>