ContactUs :

Please send your Questions & Answers or Feedback to "mohan@javabook.org"

What is the purpose of Comparator Interface?

Comparators can be used to control the order of certain data structures and collection of objects too.

The interface can be found in java.util.Comparator

A Comparator must define a compare function which takes two Objects and returns a -1, 0, or 1

Sorting can be done implicitly by using data structures of by implementing sort methods explicitly.

 

Related Posts Plugin for WordPress, Blogger...
Flag Counter