title: Converting from JsArray<JavaScriptObject> to List<JSONObject> in GWT
body: <p>In GWT, I have a JsArray&lt;JavaScriptObject&gt; in my code. It's more or less a list of JSON objects, but its type is JsArray&lt;JavaScriptObject&gt;. It basically has to be in this format, because I pass it as a parameter to some external JavaScript code using JSNI. Trouble is, I also want this value to be used by Java code. In Java, I'd prefer to deal with an object of type List&lt;JSONObject&gt;. I haven't really found a good way to convert between these two things, though. The best I've been able to do is a linear walk through the array to build the new type I want:</p>
  
  <pre><code>  public List&lt;JSONObject&gt; getData() {
     LinkedList&lt;JSONObject&gt; list = new LinkedList&lt;JSONObject&gt;();
     for (int i = 0; i &lt; data.length(); ++i) {
      list.add(new JSONObject(data.get(i)));
     }
     return list;
    }
  </code></pre>
  
  <p>Am I horribly out of luck? Or is there a nice fast way to get between these two types?</p>
  
  <p>(Returning a JSONArray of values would perhaps be OK as well... but something that implements the List interface is nice).</p>