What is the comparable interface, JAVA Programming

Assignment Help:

What is the Comparable interface?

Comparable interface is used to sort arrays and collections of objects using collections.sort() and java.utils. Objects of the class implementing Comparable interface can be ordered. All classes implementing Comparable interface should implement the compareTo() method which has the return type as an integer. Signature of compareTo() method is as below:

int i = object1.compareTo(object2)

  • If object1 < object2: The value of i returned will be negative.
  • If object1 > object2: The value of i returned will be positive.
  • If object1 = object2: The value of i returned will be zero.

 


Related Discussions:- What is the comparable interface

Map objects to a relational database? , Due to impedance mismatch between r...

Due to impedance mismatch between relational technology and object you need to understand the progress of mapping classes (objects) and their relationships to tables and relationsh

Extended eucleadian algorithm, inplementation of extended eucleadian algor...

inplementation of extended eucleadian algorithm in some cases

HELP, Design and implement an application that reads a sequence of up to 25...

Design and implement an application that reads a sequence of up to 25 pairs of names and postal (ZIP) codes for individuals. Store the data in an object designed to store a first n

Relate java with JVM, Relate java with JVM Java performance gets better...

Relate java with JVM Java performance gets better each year as JVM gets smarter. This works, since making JVM smarter doesn't require any great change to the java language, sou

Prepare an android keyboard, Prepare an android keyboard Project Descrip...

Prepare an android keyboard Project Description: I want to prepare an android keyboard that have many features.( i will describe later) I want the full app and a trial ver

Need mahjong puzzle game, Need Mahjong puzzle game I want someone to mak...

Need Mahjong puzzle game I want someone to make this game ( Mahjong puzzle game) for me in Android ONLY. If you have high level programming knowledge in Android then please b

Develop program using interactive brokers api, Develop Program using Intera...

Develop Program using Interactive Brokers API Project Description: We require a Matlab function using the Interactive Brokers API for real time trading with three arguments:

What is jms client, An application or procedure that produces and/or receiv...

An application or procedure that produces and/or receives messages.

Aspect oriented programming (aop), Aspect-Oriented  Programming  (AOP)  rep...

Aspect-Oriented  Programming  (AOP)  represents  OOP  (Object  Oriented  Programming)  by  giving  the developer to dynamically change the static OO model to make a system that can

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd