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 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.
I just want to add my 2 cents even if it is so much later. The umbrella word would be "Navigation", but...
TR:DR - Use "Neighbors" if you only peek at data, use "PrevNext" or "NextPrevious" if you imply navigation as the intention is perfectly understood.
The long story - If I see "Neighbors" I expect it to return "who are the neighbors", not "moving into their house". Like stack methods, you "peek" at top without "pop"-ping it. I'm not keen to "adjacent", but it would be the same.
If you imply navigation to previous page or next page, "PrevNext" or "NextPrevious" is absolutely fine and perfectly clear for any programmer stranger to your code what that method would do. "Navigation" or "Move" could also work, but slightly less clear for a two-way track.
Extra - Unless there is an absolute order, you could just simply use "Next" as in "It is next to you". Previous is subjectively "before" because you're indexing the pages and we read left to right. Also unless begin/end is important, you can "previous" to last page, or "next" to first page. That said, unlike "PrevNext", "Next" is closer to "what is next" much like "Neighbors" in my opinion.