Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.

I'm trying to get a list of the 10 oldest users. This is the endpoint I'm using:

http://api.stackoverflow.com/0.8/users?key=(key)&order=asc&sort=creation&pagesize=10&page=0

According to StackOverflow, they should be coming back as:

  • Community
  • Jarrod Dixon
  • Geoff Dalgas
  • Jeff Atwood
  • Jon Galloway
  • Joel Spolsky
  • Eggs McLaren
  • Kevin Dente
  • Sneakers O'Toole
  • Chris Jester-Young

However, the JSON I'm getting back has them in this order:

  • Community
  • Jeff Atwood
  • Geoff Dalgas
  • Jarrod Dixon
  • Joel Spolsky
  • Jon Galloway
  • Eggs McLaren
  • Kevin Dente
  • Sneakers O'Toole

What gives?

edit

a bit more information: Jarrod, Geoff, Jeff, Jon, and Joel all have the same creation date (1217514151, or Thu, 31 Jul 2008 14:22:31 GMT). So perhaps a better question is:

Is there defined behavior for sort ordering when two attributes have the same value?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Sorts are not guaranteed to be stable. Check the creation_date on each user to convince yourself they are in order.

share|improve this answer
    
Jeff, Geoff, Jarrod, Joel, and Jon all have the same creation date (1217514151). I think that's what the problem is. –  Dave DeLong Jun 5 '10 at 0:10
    
@Dave - its not a problem, like I said sorts are not guaranteed to be stable (en.wikipedia.org/wiki/Stable_sort#Stability) –  Kevin Montrose Jun 5 '10 at 0:23
    
understood, thanks. –  Dave DeLong Jun 5 '10 at 0:28

You must log in to answer this question.

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