Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global class AggregateResultIterator implements Iterator<AggregateResult> {
- AggregateResult [] results {get;set;}
- // tracks which result item is returned
- Integer index {get; set;}
- global AggregateResultIterator(String query) {
- index = 0;
- results = Database.query(query);
- }
- global boolean hasNext(){
- return results != null && !results.isEmpty() && index < results.size();
- }
- global AggregateResult next(){
- return results[index++];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement