title: Objectify return List & Cursor
body: <p>I am trying to use a cursor with Objectify and Google App Engine to return a subset of data and a cursor so that I can retrieve more data when the user is ready.  I found an example <a href="https://groups.google.com/forum/#!topic/objectify-appengine/IRGe-GWcSWo" rel="noreferrer">here</a> that looks exactly like what I need but I don't know how to return the final list plus the cursor.  Here is the code I have:</p>
  
  <pre><code>@ApiMethod(name = "listIconThemeCursor") //https://code.google.com/p/objectify-appengine/wiki/Queries#Cursors
  public CollectionResponse&lt;IconTheme&gt; listIconThemeCursor(@Named("cursor") String cursorStr) {
      Query&lt;IconTheme&gt; query = ofy().load().type(IconTheme.class).limit(10);
      if (cursorStr != null ) {
          query.startAt(Cursor.fromWebSafeString(cursorStr));
      }
      List&lt;IconTheme&gt; result = new ArrayList&lt;IconTheme&gt;();
      int count = 0;
      QueryResultIterator&lt;IconTheme&gt; iterator = query.iterator();
      while (iterator.hasNext()) {
          IconTheme theme = iterator.next();
          result.add(theme);
          count++;
      }
      Cursor cursor = iterator.getCursor();
      String encodeCursor = cursor.toWebSafeString();
      return serial(tClass, result, encodeCursor);
  }
  </code></pre>
  
  <p>Note that this was modified from a previous endpoint in which I returned the CollectionResponse of ALL the data.  My dataset is large enough that this is no longer practical.  Basically, I don't know what was in the user's function of 'serial(tClass, result, encodeCursor) that let it get returned to the user.</p>
  
  <p>There is another example <a href="https://code.google.com/p/objectify-appengine/wiki/Queries#Cursors" rel="noreferrer">here</a> but it doesn't appear to answer my question either.</p>