Prepare
Practice
Interview
Aptitude
Reasoning
English
GD
Placement papers
HR
Current affairs
Engineering
MCA
MBA
Online test
Login
Online Practice Test
>
Java Part 2
« Previous
Next »
_____________ can be used to control the order of certain data structures and collection of objects too.
Options
- Serial Comparators
- Natural Comparators
- Comparators
- All of above
CORRECT ANSWER : Comparators
Discussion Board
Comparators
Comparators can be used to control the order of the data structures and objects. Comparator function imposes total ordering on collections of the objects. It can be passed to a sort method like Collection.sort or Arrays.sort to have the command over the sort order of these type of data structures and its objects. It is also used to control certain data structures like sorted sets and maps that provides the ordering for the collections of the objects having no natural ordering.
Comparator function sometimes behave in inconsistent manner as far as the ordering is concerned. It is always the best way to implement java.io.Serializable, as they have the predefined ordering methods in serializable data structures (like TreeSet, TreeMap).
Rohit Sharma 08-6-2014 05:26 PM
« Previous
Next »
Write your comments
*
*
Email must be in the form someone@domain.com
*
*
Enter the code shown above:
Please enter the code shown above
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)
Related Content
Java Beginner (11)
Java (39)
Java (40)
Java (22)
Java (30)
Java (25)
Java (20)
Java (20)
Core Java (20)
Core Java (10)
Core Java (72)
EJB (20)
JDBC (20)
Applet (20)
Struts (21)
Servlets (20)
Java Web Services (20)
Javascript (40)
J2EE (10)
jQuery (46)
Advertisement
▲