---
title: getNextObject
framework: kernel
role: pseudoSymbol
path: kernel/oscollectioniterator/1808125-getnextobject
---

# getNextObject

Advances to and returns the next object in the iteration.

## Declaration

```occ
virtual OSObject * getNextObject(); 
```

## Return Value

Return Value The next object in the iteration context, NULL if there is no next object or if the iterator is no longer valid.

## Overview

Overview This function first calls isValid and returns NULL if that function returns false. Subclasses must implement this pure virtual function to check for validity with isValid, and then to advance the iteration context to the next object (if any) and return that next object, or NULL if there is none.

## See Also

### Miscellaneous

- [free](kernel/oscollectioniterator/1808113-free.md)
- [initWithCollection](kernel/oscollectioniterator/1808147-initwithcollection.md)
- [isValid](kernel/oscollectioniterator/1808157-isvalid.md)
- [reset](kernel/oscollectioniterator/1808170-reset.md)
- [withCollection](kernel/oscollectioniterator/1808183-withcollection.md)
