1

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?

1 Answer 1

1

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

2
  • Jeff, Geoff, Jarrod, Joel, and Jon all have the same creation date (1217514151). I think that's what the problem is. Commented Jun 5, 2010 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) Commented Jun 5, 2010 at 0:23

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.