I'm looking for an umbrella term for "next" and "previous" so that I don't have to call my programming methods "NextPrevious".
Is there a hypernym for the two?
How about adjacent:
Next to or adjoining something else
Other options you could incorporate into your method name include near, neighbor, and one over.
If you are iterating some list-like recursive structure, same level entities can be called siblings. For example, in tree children sharing the same parent are called siblings.
But sibling include also the node, compare to which one other nodes can are next or previous.
If next and previous are something about, say, navigation buttons, better stay with those words.