What is the hypernym for "next" and "previous"?

Solution 1:

How about adjacent:

Next to or adjoining something else

Other options you could incorporate into your method name include near, neighbor, and one over.

Solution 2:

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 current 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.