GetNext
GetNext is a common naming convention for a function or method used in software libraries and programming languages to retrieve the next element in a sequence, stream, cursor, or other ordered data source. The term is not tied to a single standard; it appears across languages and APIs as a design pattern for advancing through data.
Typically, a GetNext operation advances the internal position and returns the subsequent item if one exists.
Illustrative examples of usage include:
- Pseudocode: function GetNext(it) if it.hasNext() then return it.next() else return EndOfSequence
- Database cursor: GetNextRow(cursor) fetches the next row and returns null when exhausted
- Streaming API: GetNextChunk(stream) reads and returns the next data chunk
Variations and naming differences are common. GetNext is one of several iteration-related conventions; others include Next,