Sign in to follow this  
jnrprogrammer

type Comparable

Recommended Posts

Illco    928
I presume it is Java. First of all it is not a type but an interface. Second, if you don't know what it is for don't use it and don't bother.

It is for specifying a generic interface for comparable objects, such that any algorithms implemented for comparable objects can be applied to all their specific instances.

For example you may write a sorter which sorts any object that implements the comparable interface. This way you can sort any objects (even those not known at writing-time) such as a Date-class, Integers, etc. Nice.

Illco

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this