public static <J> CursorList<J> create(SimpleQuery query, int size, boolean cursorOnLastPage) {
		query.withPrefetchSize(size);
		CursorList<J> result = new CursorList<J>();
		result.query = query;
		result.data = Lists.newArrayListWithCapacity(size);
		CursorIterator<J> it = query.asIterator();
		for (int i = 0; it.hasNext() && i < size; i++) {
			result.data.add(it.next());
		}
		if (it.hasNext() || cursorOnLastPage) {
			result.cursor = it.getCursor();
		}
		return result;
	}
public static < J > CursorList < J > create ( SimpleQuery query , int size , boolean cursorOnLastPage ) { query . withPrefetchSize ( size ) ; CursorList < J > result = new CursorList < J > ( ) ; result . query = query ; result . data = Lists . newArrayListWithCapacity ( size ) ; CursorIterator < J > it = query . asIterator ( ) ; for ( int i = 0 ; it . hasNext ( ) && i < size ; i ++ ) { result . data . add ( it . next ( ) ) ; } if ( it . hasNext ( ) || cursorOnLastPage ) { result . cursor = it . getCursor ( ) ; } return result ; }
Create a new CursorList instance.
@param query the query to execute
@param size the size of the CursorList data. To retrieve more data, use query.withStartCursor()
@param cursorOnLastPage if true, the cursor will be not null even on the last page of results. Useful to check for new contents after the last page has been retrieved.
@return the created {@link CursorList} instance