Wanted to understand how compareTo method works when there is no implmentation
up vote
0
down vote
favorite
Could you please help me understand how the below code works
static <T extends Comparable<T>> boolean less(T v, T w) {
return v.compareTo(w) < 0;
}
I could see that there is no implementation given for the compareTo method and it still works fine, could you please let me know how it works.
I wanted to understand how the natural ordering is done. where can i see the code for that.
compareto
add a comment |
up vote
0
down vote
favorite
Could you please help me understand how the below code works
static <T extends Comparable<T>> boolean less(T v, T w) {
return v.compareTo(w) < 0;
}
I could see that there is no implementation given for the compareTo method and it still works fine, could you please let me know how it works.
I wanted to understand how the natural ordering is done. where can i see the code for that.
compareto
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Could you please help me understand how the below code works
static <T extends Comparable<T>> boolean less(T v, T w) {
return v.compareTo(w) < 0;
}
I could see that there is no implementation given for the compareTo method and it still works fine, could you please let me know how it works.
I wanted to understand how the natural ordering is done. where can i see the code for that.
compareto
Could you please help me understand how the below code works
static <T extends Comparable<T>> boolean less(T v, T w) {
return v.compareTo(w) < 0;
}
I could see that there is no implementation given for the compareTo method and it still works fine, could you please let me know how it works.
I wanted to understand how the natural ordering is done. where can i see the code for that.
compareto
compareto
asked Nov 13 at 11:07
Vignesh
165
165
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279664%2fwanted-to-understand-how-compareto-method-works-when-there-is-no-implmentation%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown