QueryLocatorIterator Class
Represents an iterator over a query locator record set.
This sample shows how to obtain an iterator for a query locator, which contains five accounts. This sample calls hasNext and next to get each record in the collection.
The following are methods for QueryLocatorIterator. All are instance methods.
-
Returns
trueif there are one or more records remaining in the collection; otherwise, returnsfalse. -
Advances the iterator to the next sObject record and returns the sObject.
Returns true if there are one or more records remaining in the collection; otherwise, returns false.
public Boolean hasNext()
Type: Boolean
Advances the iterator to the next sObject record and returns the sObject.
public sObject next()
Type: sObject
Because the return value is the generic sObject type, you must cast it if using a more specific type. For example: