What is difference between Collections. Sort() and Arrays.sort()? Which one is better with respect to time efficiency?

By | August 12, 2019

In this blog post we will discuss about one of the very important java interview question What is difference between Collections. Sort() and Arrays.sort()? Which one is better with respect to time efficiency?

Collections.sort() internally calls Arrays.sort() and thus the underlying algorithm for both of these methods is same. The only difference is the type of input these methods accept.  Quick Sort algorithm is used by Arrays.sort() method.

You may also like:

When should we choose LinkedList over ArrayList for a given Scenario and Why?
Is there concurrent version for TreeMap and TreeSet in Java Collections Framework?
What are fail-fast and fail-safe Iterator?
What is difference between Iterator and LisIterator?
Why Prime Numbers are considered in writing certain algorithms like hashcode()?

That’s all about  What is difference between Collections. Sort() and Arrays.sort()? Which one is better with respect to time efficiency?
If you have any feedback or suggestion please feel free to drop in blow comment box.

Leave a Reply

Your email address will not be published. Required fields are marked *