14

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?

0

3 Answers 3

12

How about adjacent:

Next to or adjoining something else

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

0
1

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.

4
  • 1
    This is for paging, but I don't think sibling would be appropriate. For example if I was on Page 5, I'm referring to Page 4 and 6. Whereas sibling would refer to all pages
    – Curtis
    Commented Oct 17, 2012 at 15:13
  • Good points. If the OP offers more details about what his method does, perhaps we could give a more apt name. However, the question is ultimately about the hypernym for the terms. Sibling, like neighbor in my answer, sort of works (in a programming context).
    – Zairja
    Commented Oct 17, 2012 at 15:15
  • @Curt, oh, I see, I've thought you are searching an umbrella term in a more general sense )
    – shabunc
    Commented Oct 17, 2012 at 15:16
  • @Zairja, neighbour is a better choice, so I've upvoted your answer)
    – shabunc
    Commented Oct 17, 2012 at 15:17
1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .