Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Which sort does sort() use?

 
Manish Malik
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Which sorting algorithm does sort() function use?
 
Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which sort() are you referring to? java.util.Arrays.sort() uses a form of Quicksort.
Originally posted by Manish Malik:

Which sorting algorithm does sort() function use?

 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And the one in Collections uses a mergesort. The API has more details. Always check the API. If you want more, you can always look at the source code inside src.jar.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic